Commit Graph

160 Commits

Author SHA1 Message Date
Alessio Bogon 3700cb4296 PoC @scenario_class(...) class generator 2022-07-31 07:05:36 +02:00
Alessio Bogon 84eab05bc4 Remove TODO. I have better plans for `scenarios` 2022-07-30 11:57:41 +02:00
Alessio Bogon a16d246842 Add stacklevel param to the steps, implement a test that makes use of it 2022-07-29 16:23:31 +02:00
Alessio Bogon a6de47a562 Improve function names, add docstring 2022-07-27 21:25:55 +02:00
Alessio Bogon 0e08d87074 Refactor params, use Step when possible 2022-07-27 21:05:49 +02:00
Alessio Bogon 35412a6d02 Refactor 2022-07-27 20:18:58 +02:00
Alessio Bogon 2d64e9f135 Refactor 2022-07-27 20:06:20 +02:00
Alessio Bogon 63a4268b9c Fix bug when 2 steps have the same step name...
... but only one step impl was kept.
2022-07-27 17:02:35 +02:00
Alessio Bogon 91fe7ed33c Fix step detection for generation 2022-07-26 18:03:07 +02:00
Alessio Bogon 8ee02ab5e2 Refactor code 2022-07-25 23:52:44 +02:00
Alessio Bogon f6a78cf375 fix typo 2022-07-24 19:46:09 +02:00
Alessio Bogon 020c443941 Stub fix for finding the right fixture for step definition 2022-07-24 00:02:52 +02:00
Alessio Bogon 62e60c664d we also need to catch fixture dependencies errors 2022-07-15 18:19:05 +02:00
Alessio Bogon 143dabc71d check step type first, it's less expensive 2022-07-15 18:02:46 +02:00
Alessio Bogon 5c02da2ae7 Inline functin _find_step_function 2022-07-15 18:01:16 +02:00
Alessio Bogon e7c7f54089 tighten the try-body so that we catch only in case of step failure 2022-07-15 17:55:50 +02:00
Alessio Bogon 9c3712d70b parser not nullable 2022-07-10 17:47:20 +02:00
Alessio Bogon 9f4ddb1c99 Fix `target_fixture` being overridden at every step decoration 2022-07-10 17:04:21 +02:00
Alessio Bogon f5aafe594d Fix buggy fixture discovery.
Items in fixturemanager._arg2fixturedefs are LIFO, not FIFO
2022-07-10 16:42:31 +02:00
Alessio Bogon 9dad1e9063 Rename variable 2022-07-10 15:35:51 +02:00
Alessio Bogon 02b16d3547 Simplify function 2022-07-10 15:34:59 +02:00
Alessio Bogon 06b3f9997d try-catch only block that can raise 2022-07-10 15:31:55 +02:00
Alessio Bogon a2a94adff1 Fix bug where normal steps would take precedence over other parsers. 2022-07-10 15:26:01 +02:00
Alessio Bogon cf104cb045 Put (almost) everything in the StepFunctionContext 2022-07-10 15:08:43 +02:00
Alessio Bogon 0aa30dde52 Rename function 2022-07-10 14:33:20 +02:00
Alessio Bogon 6a2fcfbcd0 Refactor _find_step_function to be readable, hopefully 2022-07-10 14:30:10 +02:00
Alessio Bogon 36bb1b9f32 Make sure step functions can be reused with converters 2022-07-10 14:20:30 +02:00
Alessio Bogon 1c6a2b3c3e use dict literals 2022-07-08 14:59:00 +02:00
Alessio Bogon 10b5ac90e2 Remove unused argument 2022-07-08 14:57:34 +02:00
Alessio Bogon 7f167007de Prefix private attributes set by pytest_bdd, only attach them to the function that need them 2022-07-07 19:03:24 +02:00
Alessio Bogon 81c1bef7aa Partially revert changes, just attach 1 parser to the lazy_step_func, and all the parsers to the actual function 2022-07-07 18:57:41 +02:00
Alessio Bogon 6e1566bb68 Removing clutter from the step_func 2022-07-07 16:30:25 +02:00
Alessio Bogon 15e1a8aa20 Handle multiple parsers connected to a step function 2022-07-06 18:09:29 +02:00
Alessio Bogon 624d5e8b24 "raise from" so that exception cause is correctly marked 2022-07-03 22:26:09 +02:00
Alessio Bogon 3ebd5b3124 Fix runtime 2022-03-03 13:52:18 +01:00
Alessio Bogon 50d6e2283f Add typing 2022-03-03 13:38:25 +01:00
Alessio Bogon 98e33033a9 Check that we got a compatible value type 2022-02-24 16:53:43 +01:00
Alessio Bogon 3e49f3b6df Fix types 2022-02-24 16:53:27 +01:00
Alessio Bogon 644df2ee52 Use newer typing syntax 2022-02-24 16:00:36 +01:00
Alessio Bogon 021aa3a2e3 Use "from __future__ import annotations" to be less verbose 2022-02-24 15:32:20 +01:00
Alessio Bogon 4fd1ab950c Merge remote-tracking branch 'origin/master' into add-type-annotations
# Conflicts:
#	pytest_bdd/parser.py
#	pytest_bdd/scenario.py
2022-02-24 14:04:24 +01:00
Alessio Bogon 1bd6998263 Remove unused code 2022-02-24 13:19:14 +01:00
Alessio Bogon 8fe2e4ff3c Execute step definitions as if they were pytest fixture.
This way we can get the same behaviour of yield-fixtures.
2022-02-22 16:12:54 +01:00
pre-commit-ci[bot] 437bb6315d [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-01-15 20:36:38 +01:00
Oleg Pidsadnyi 7cd7b40df3 Step arguments are no longer fixtures 2022-01-15 20:36:38 +01:00
Oleg Pidsadnyi e0a1437908 Feature examples removal. Compatibility with official gherkin 2022-01-15 19:07:11 +01:00
Alessio Bogon 78cf86af32 Fix many types 2021-10-20 17:15:03 +02:00
Alessio Bogon 4ddb257230 Get `pytest tests/` to work again 2021-10-01 20:51:59 +02:00
Alessio Bogon 7ab5aeeb2a Blindly add annotations using pyannotate. A lot to fix.
Commands run:
```
pytest tests/
pyannotate --py3 -w pytest_bdd tests
git add pytest_bdd tests
pre-commit run
```
2021-10-01 20:17:43 +02:00
Alessio Bogon 379cb4b47c
Rewrite scenario/feature examples logic (#445)
* rewrite examples subsitution using templating

* Remove “example_converters”

* Remove "expanded" option. It's now the default

* Add utility functions to be able to inspect tests run by the pytester.

* use better timer

* Fix typos

* Fix and simplify tests

* Update to latest python 3.10 version

* Add isort configuration and pre-commit hook

* Fix imports

* Fix types

* Update changelog

* Update README (mainly fix typos, remove outdated options)

* Fix examples in README

* Remove python2 junk

Co-authored-by: Oleg Pidsadnyi <oleg.pidsadnyi@gmail.com>
2021-09-23 21:07:15 +02:00