Commit Graph

295 Commits

Author SHA1 Message Date
Florian Bruhin 3f1ba96c2d Fix gherkin terminal reporter test flakiness (#340)
The test compares the output of two different reporters and tries to account for
the different runtime being printed. However, the output format changed with
pytest v5.1.0:

https://docs.pytest.org/en/latest/changelog.html#id76

This changes the regex to be a bit more permissive.
2019-11-20 22:19:18 +01:00
Mark Moes 34b7f96b77 Escape quote in generation (#327)
* Escape single quotes in generated test names

* Escape single, double, triple-single and triple-double quoted (doc)strings in generated code
2019-10-20 18:53:29 +02:00
Alessio Bogon c6b16b676b
Refactor code coverage configuration (#321)
* Switch from Coveralls.io to Codecov.io
* Use `coverage` directly instead of `pytest-cov`, it seems to solve issues
2019-08-27 18:16:15 +02:00
Alessio Bogon 6047a35ef1 Apply `black` formatter to the codebase 2019-08-27 17:54:58 +02:00
James Harris b95e8e35c3 Fix pytest --generate --fixtures flag
This patch resolves the issues where pytest will try to double load the
pytest_cmd_main.
2019-08-23 21:51:40 +02:00
Alessio Bogon 386ed90cec
Fix item collection breaking when non Function items are present (#318)
* Fix item collection breaking when non Function items are present

* Bump version 3.2.1
2019-08-21 13:21:08 +02:00
Alessio Bogon 2226128936
Remove code that rewrites code (#309)
* Stop testing for old pytest and python versions

* Switch from pytest-pep8 to pycodestyle.

Pytest-pep8 received the last update in 2014, and it is now not working with pytest >= 4.5

* Explicitly state used markers

* Remove supposedly useless test

* Fix pytest missing markers definitions

* Fix pytest missing markers definitions

* Fix wrong command line usage

* Remove compatibility with ancient pytest

* Be more lenient when checking for failed test string

* Remove dead code
2019-08-20 10:49:20 +02:00
Blaise Kal d8ebeeed1c Add test for given names with unicode types 2019-07-07 14:41:57 +02:00
Alessio Bogon fa9fb67d39 Fix wrong command line usage 2019-07-05 15:14:58 +02:00
Alessio Bogon eafd61abae Fix pytest missing markers definitions 2019-07-05 15:14:58 +02:00
Alessio Bogon e06156b5dc Fix pytest missing markers definitions 2019-07-05 15:14:58 +02:00
Alessio Bogon 1f095c3713 pep8 2019-07-05 15:14:58 +02:00
Alessio Bogon 378eeba9c7 Mark some tags to avoid warning in result 2019-07-05 15:14:58 +02:00
Alessio Bogon a18641490e Remove supposedly useless test?
That test is now breaking in pytest 4.6, and it is a weird one anyway
2019-07-05 15:14:58 +02:00
Alessio Bogon 545c6ca5b0 Explicitly state used markers 2019-07-05 15:14:58 +02:00
Alessio Bogon 76a75ea3e6 Switch from pytest-pep8 to pycodestyle.
Pytest-pep8 received the last update in 2014, and it is now not working with pytest >= 4.5
2019-07-05 15:14:58 +02:00
Milosz Sliwinski b3370c3c55 gherkin terminal reporter tests steps renamed to not being collected as test items by pytest 2019-07-04 15:56:58 +02:00
Alessio Bogon c298a3edf5 Do not accept regex as step definitions 2019-02-19 13:59:09 +01:00
Alessio Bogon 61bf486ac2
Merge branch 'master' into generated-steps-raise-notimplemented 2019-02-18 10:53:02 +01:00
Alessio Bogon ee05a101e9 drop compatibility with pytest < 3.0.0 2019-02-18 10:26:14 +01:00
Alessio Bogon eded49a2ae Generated step files should raise NotImplementedError 2019-02-17 18:08:38 +01:00
Milosz Sliwinski 04353d29f3 Fixed test which was failing because starting from pytest 4.2.0, SKIPPED is used instead of SKIP in report for skipped tests 2019-02-11 09:52:26 +01:00
Milosz Sliwinski 07efb553d4 In tests use -m instead of -k for running tests by marker expressions 2019-01-10 10:46:38 +01:00
Milosz Sliwinski fb44fc3a98 Fixes #273: Fix for unicode steps in gherkin reporter (#274)
* Fixes #273: Fix for unicode steps in gherkin reporter

* Test unicode step names in gherkin expanded mode

* Unnecessary encoding declaration in gherkin reporter test removed

* Fix unicode steps by using unicode_literals in gherkin_terminal_reporter.py
2018-12-16 12:08:44 +01:00
Milosz Sliwinski 5678a5c84e Do not use deprecated MarkInfo objects on pytest>=3.6 (#262)
* Do not use deprecated MarkInfo objects on pytest>=3.6

* Provide way to get all parametrize args, not only the ones from the closest marker

* Fix for remaining tests that were using depracated MarkInfo objects
2018-11-14 10:24:04 +01:00
Milosz Sliwinski 7671290ad0 bdd_feature_base_dir renamed into bdd_features_base_dir 2018-10-18 10:59:28 +02:00
Milosz Sliwinski 46644c390c Add feature_base_dir and strict_gherkin params to scenario and scenarios 2018-10-18 10:59:28 +02:00
Milosz Sliwinski 6ce9c0c510 Do not call fixtures directly. bdd_feature_base_dir and bdd_strict_gherkin ini configs added. Pytest-bdd fixtures removed 2018-10-18 10:59:28 +02:00
Anthony Sottile 685ae80f10 Mostly factor out `py` module
Still used for `py.io.TerminalWriter` so I added it to `setup.py`
2018-07-07 15:30:03 -07:00
Anthony Sottile ce63d93152 Fix invalid escape sequences 2018-06-30 08:35:52 -07:00
Oleg Pidsadnyi 5684b36532 Preparing release 2.21.0 2018-04-04 16:13:29 +02:00
Dmitry Kolyagin d1eaf99270 Add --gherkin-terminal-reporter-expanded option (#222) 2018-04-04 15:59:29 +02:00
Oleg Pidsadnyi 7c6ba36ffc
Fixes #201 and pytest compatibility. (#232)
* Fixes #201 and pytest compatibility.

* Review comments
2018-01-23 20:43:43 +01:00
Michiel Holtkamp 2ab960a626 Fill in step names in cucumber report.
According to [1], when the outline scenarios are
reported in 'expand' mode, all the outlines will
be expanded to scenarios with their test results.
Also, the step name parameters are filled in.

This is a different mode than without 'expand'
mode[2], where the scenario outlines are reported
so the step names are not filled in and there are
no test results. The "examples" are reported in
this mode.

Since pytest-bdd does report the results of each
step of an outline scenario as separate scenarios,
it looks more like the 'expand' mode, so I've
added the filling in of the parameters in the
step names to make it more compliant.

[1] https://relishapp.com/cucumber/cucumber/docs/formatters/json-output-formatter#scenario-outline-expanded
[2] https://relishapp.com/cucumber/cucumber/docs/formatters/json-output-formatter#scenario-outline
2017-11-03 12:38:03 +01:00
Sergey Kraynev 5d40f2c28e Fix #210 do not raise wrong Error for no strict gherkin feature
The issue, that if user disable strict gherkin check, it will lead to
situation, when wrong Error be raised. For the current situation it was
a message, that Step is defined outside of Background section.

Current patch makes check for orphan steps more tolerant for features
without strict gherkin syntax.

Also README was updated to show explicitly, that using "When, Then" is
prohibited in "Background" section.
2017-04-27 09:37:22 +03:00
Omer Katz 3d8447a6c0 Merge branch 'master' into ISSUE-139-gherkin-terminal-reporter 2016-09-20 09:02:27 +03:00
Omer Katz 2e2b7a5c1b Merge branch 'ISSUE-139-gherkin-terminal-reporter' of git://github.com/spinus/pytest-bdd into ISSUE-139-gherkin-terminal-reporter 2016-09-18 11:19:46 +03:00
Florian Bruhin 14cc037c58 Don't parse scenario lines containing @ as tag 2016-09-15 17:39:28 +02:00
Bruno Oliveira 7f16bc93ea Last pytest 3.0 compatibility fixes 2016-08-19 16:47:56 +02:00
Florian Bruhin 27553d8222 Make fixture code pytest 3.0 compatible 2016-08-05 13:32:40 +02:00
Florian Bruhin 0e8debd30b Don't use skip-mark in test_apply_tag_hook
@pytest.mark.skip was only introduced in pytest 2.9. Use xfail for
testing instead which will work with older pytest versions as well.
2016-06-30 08:59:28 +02:00
Florian Bruhin 9b78948efa Allow spaces in tags 2016-06-29 19:21:55 +02:00
Oleg Pidsadnyi 30947a458b Fixing flaky test order 2016-06-22 10:25:45 +02:00
Florian Bruhin c53f7a7519 Add pytest_bdd_apply_tag hook 2016-06-21 18:27:02 +02:00
Oleg Pidsadnyi cc87b5b0dd Better error explanation for the steps defined outside of scenarios 2016-06-21 16:08:31 +02:00
Oleg Pidsadnyi be79c1d534 Cleaned up hooks of the plugin, fixed report serialization to use builtin types. 2016-03-19 00:54:03 +01:00
Florian Bruhin b5738ad1e4 Allow tags after background section - fixes #160. 2016-01-24 19:52:05 +01:00
Oleg Pidsadnyi 1049452a2a Cleaned up hooks 2016-01-24 00:44:29 +01:00
Tomasz Czyż 620a41ec40 ISSUE-139 add gherkin terminal reporter 2015-12-26 23:32:49 +00:00
Anatoly Bubenkov fbaf239e83 Add examples data in the scenario report. closes #145 2015-08-31 16:39:02 +02:00
Anatoly Bubenkov 7cda3caeef Properly parse feature description. closes #144 2015-08-31 10:32:23 +02:00
Anatoly Bubenkov d18ba44f20 Add validation check which prevents having multiple features in a single feature file. closes #135 2015-07-07 22:49:49 +02:00
Anatoly Bubenkov 831d2122dc increase test coverage 2015-06-24 01:17:34 +02:00
Anatoly Bubenkov 24522b8fdc Allow mixing feature example table with scenario example table 2015-06-23 23:10:13 +02:00
Anatoly Bubenkov e313294c77 Feature example table. closes #131 2015-06-21 00:41:05 +02:00
Anatoly Bubenkov 8af2e0f0e0 feature outline 2015-06-21 00:30:46 +02:00
Anatoly Bubenkov 2b96f61268 respect strict_gherkin also for scenarios shortcut 2015-06-20 23:55:27 +02:00
Anatoly Bubenkov f4f0f99563 respect strict_gherkin also for backgrounds 2015-06-19 10:34:59 +02:00
Anatoly Bubenkov a7272beea2 Make it possible to relax strict Gherkin scenario validation. closes #118. closes #119 2015-06-15 23:58:45 +02:00
Anatoly Bubenkov 954180716c Mention step type on step definition not found errors and in code generation. closes #125 2015-06-10 10:03:17 +02:00
Laurence Rowe 5bdb0a4b97 Prefix step definition fixture names to avoid name collisions 2015-06-07 23:04:12 +02:00
Anatoly Bubenkov 8209470b27 Make feature and scenario tags to be fully compartible with pytest markers. closes #112 2015-06-04 14:02:19 +02:00
Anatoly Bubenkov 24684bfb82 Fixed FeatureError string representation to correctly support python3. closes #115 2015-06-04 10:29:18 +02:00
Anatoly Bubenkov 27d8e1c382 step fixture injection 2015-05-24 10:17:17 +02:00
Oleg Pidsadnyi 97de1158fd Added hook before the step is executed with evaluated parameters 2015-05-18 13:24:02 +02:00
Anatoly Bubenkov 83e8a9def7 Allow to pass scope for given steps. closes #109 2015-04-07 18:40:45 +02:00
Anatoly Bubenkov 940dc968fb increase coverage 2015-03-19 00:39:08 +01:00
Anatoly Bubenkov 29f2c1cbe4 Implemented shortcut to automatically bind scenarios to tests. closes #103, #89, #92, #90 2015-03-18 23:51:37 +01:00
Anatoly Bubenkov 48336f1f94 add coding to generated code. closes #105 2015-03-17 22:57:20 +01:00
Anatoly Bubenkov c4b2e7fe92 elaborate that step arguments are normal fixtures. #104 2015-03-16 23:48:15 +01:00
Leonardo Santagada 41acbf4148 better parsing of comments, fix #99 2015-03-15 12:19:52 -03:00
Anatoly Bubenkov d1fa804426 Pluggable parsers for step definitions. closes #91 2015-01-07 16:26:20 +01:00
Anatoly Bubenkov 9e2d1d6231 Add after scenario hook, document both before and after scenario hooks. closes #87 2014-12-28 11:52:41 +01:00
Anatoly Bubenkov c2df5b9873 Fix code generation steps ordering. closes #85 2014-12-17 22:49:02 +01:00
Oleg Pidsadnyi 38d3ad9e0a Generation tests improved 2014-11-10 09:58:46 +01:00
Oleg Pidsadnyi 440d669d1c Fix for python26 2014-11-09 13:59:27 +01:00
Oleg Pidsadnyi 7fcd7e2eba Refactor of the feature step, reporting and fix for the multiline background steps. 2014-11-09 12:56:50 +01:00
Anatoly Bubenkov 455c81aed0 Fix unicode issue with scenario name 2014-10-22 11:19:43 +00:00
Anatoly Bubenkov 2dd81a5ba7 translate unicode tests to the right language 2014-10-22 07:28:48 +00:00
Anatoly Bubenkov 002c517093 Fix unicode regex argumented steps issue, reimplements #75 2014-10-21 16:08:42 +00:00
Anatoly Bubenkov f4e80f9067 put assertion back 2014-09-24 10:39:16 +00:00
Anatoly Bubenkov 8e8be17a43 correct generated function names 2014-09-24 08:49:21 +00:00
Anatoly Bubenkov 28e4932a3b correct recursion for --feature parameter of --generate-missing 2014-09-24 08:03:49 +00:00
Anatoly Bubenkov c6dc04386f Validation/generation helpers 2014-09-22 23:31:33 +00:00
Anatoly Bubenkov 47694d0299 BDD tests validation/generation helpers 2014-09-22 06:27:33 +00:00
Anatoly Bubenkov 5433bfeb61 Correct timing values for cucumber json reporting 2014-09-20 00:18:19 +00:00
Anatoly Bubenkov 57431dc218 Implement simple code generation command. Closes #32 2014-09-19 19:28:47 +00:00
Anatoly Bubenkov 771f263ec6 Better reporting of a not found scenario 2014-09-18 18:32:50 +00:00
Oleg Pidsadnyi 6758382bf9 Merge pull request #66 from bubenkoff/background-support
Background support added. closes #16
2014-09-15 09:56:44 +02:00
Anatoly Bubenkov 8d28d15e52 Background support added. closes #16 2014-09-14 22:52:28 +00:00
Robin Pedersen 4298c854ac Fix python3 errors 2014-09-12 12:46:40 +02:00
Robin Pedersen e7857831dc Add test to demonstrate issue #62 2014-09-12 12:17:02 +02:00
Anatoly Bubenkov 0dd249c999 cucumber json timings added 2014-09-10 23:24:14 +00:00
Anatoly Bubenkov 7fcfb20f33 implemented cucumber tags 2014-07-27 13:31:38 +00:00
Anatoly Bubenkov 6e80100ae0 multiple steps instead of one 2014-07-26 12:37:55 +00:00
Anatoly Bubenkov 5aaf42e4b5 better reporting 2014-07-25 22:17:58 +02:00
Anatoly Bubenkov 15f95dfdba merge with master 2014-07-24 17:38:42 +02:00
Anatoly Bubenkov 8a668eab36 Update test_steps.py 2014-06-10 22:31:12 +02:00
Anatoly Bubenkov 45767b4058 Update test_steps.py 2014-06-10 22:24:38 +02:00
Anatoly Bubenkov dfe111703b Update test_steps.py 2014-06-10 22:16:11 +02:00
Anatoly Bubenkov 3f5da0f4a0 pep fixes 2014-05-11 17:02:11 +02:00
Anatoly Bubenkov 34a4ac65dd Merge branch 'cucumber-json-formatter' of github.com:albertjan/pytest-bdd into cucumber-json-formatter 2014-05-11 16:47:59 +02:00
Anatoly Bubenkov 62898e5a00 PR 2014-05-11 16:47:37 +02:00
albertjan d740515a9f clean up and use rel path 2014-05-11 16:43:45 +02:00
Anatoly Bubenkov be87dffccb fix failing test 2014-05-11 16:36:17 +02:00
albertjan 9c196534f5 corrects the reference 2014-05-11 16:19:32 +02:00
albertjan faa5ececc1 corrects the reference 2014-05-11 16:15:11 +02:00
albertjan 504d722864 makes the keyword nice 2014-05-11 16:05:13 +02:00
Anatoly Bubenkov cb6db6fb4a Merge branch 'cucumber-json-formatter' of github.com:albertjan/pytest-bdd into cucumber-json-formatter 2014-05-11 15:52:27 +02:00
Anatoly Bubenkov aa81fea6c0 correct expectation 2014-05-11 15:52:18 +02:00
albertjan 1f62168f1f add feature hash 2014-05-11 15:39:29 +02:00
Anatoly Bubenkov 127cba2d4e equals_any added 2014-05-11 15:26:10 +02:00
albertjan 3d10266894 Merge branch 'cucumber-json-formatter' of https://github.com/paylogic/pytest-bdd into cucumber-json-formatter 2014-05-11 13:18:48 +02:00
Anatoly Bubenkov fd16428ab7 store item in the report 2014-05-11 13:18:43 +02:00
Anatoly Bubenkov c22464f01a fix test 2014-05-11 11:26:18 +02:00
albertjan c9b509a296 correct func name 2014-05-11 11:21:09 +02:00
Anatoly Bubenkov 3b60a9e0e5 start implementing cucumber json 2014-04-09 00:40:30 +02:00
Anatoly Bubenkov 3370bcf714 more complex parsing of the multiline steps 2014-04-01 01:58:50 +02:00
Anatoly Bubenkov 60591ced61 multiline steps implemented 2014-03-29 00:58:38 +01:00
Anatoly Bubenkov dbe3f9da31 allow empty example values 2014-03-27 11:54:12 +01:00
Oleg Pidsadnyi 7955801852 Merge branch 'master' of github.com:olegpidsadnyi/pytest-bdd 2014-03-26 20:50:34 +01:00
Anatoly Bubenkov 482482b059 code cleanup. vertical example table implemented 2014-03-15 01:05:21 +01:00
Anatoly Bubenkov c0ae33a241 move to single decorator 2014-03-14 14:15:04 +01:00
Anatoly Bubenkov c5237a217e move to single decorator approach 2014-03-14 13:20:43 +01:00
Anatoly Bubenkov e23d8e6180 update the prototype of decorated function 2014-03-14 09:54:17 +01:00
Anatoly Bubenkov 6fb6fa77be add test for the outline 2014-03-14 09:22:15 +01:00
Anatoly Bubenkov e3e4cb6ad2 Scenario outline implementation based on pure pytest parametrization 2014-03-13 18:33:53 +01:00
Oleg Pidsadnyi f9b53fe6e2 Merge branch 'master' of github.com:olegpidsadnyi/pytest-bdd
Conflicts:
	README.rst
	pytest_bdd/scenario.py
	setup.py
2014-03-10 23:54:55 +01:00
Anatoly Bubenkov d3928c7e4d scenario outlines implemented 2014-03-10 23:03:11 +01:00
Oleg Pidsadnyi 92a9377cec Fixed step arguments conflict with the fixtures having the same name 2014-02-19 12:48:14 +01:00
Oleg Pidsadnyi 8d89a4f388 gherkin feature support 2014-01-29 12:09:46 +01:00
Anatoly Bubenkov c3121c82c8 fixes for step hooks 2013-12-13 04:27:25 +01:00
Anatoly Bubenkov 6eccae04e9 Merge branch 'hooks-initial-implementation'
Conflicts:
	CHANGES.rst
	setup.py
	tests/feature/test_steps.py
2013-12-11 10:22:25 +01:00
Anatoly Bubenkov 011409b029 hide scenario module in pytest verbose mode 2013-12-11 03:43:58 +01:00
Anatoly Bubenkov 652ab40fbe remove unnecessary hooks. add documentation 2013-12-11 00:01:42 +01:00
Anatoly Bubenkov 220ed6d4b7 remove print 2013-12-06 09:07:20 +01:00
Anatoly Bubenkov c85094c1ab hooks initial implementation 2013-12-06 04:19:10 +01:00
Andrey Makhnach 2e3357aa9d extra fix for encoding 2013-11-10 11:24:19 +01:00
Anatoly Bubenkov d9b10a7f79 arguments in when steps when no arguments in givens bug 2013-09-27 13:38:37 +02:00
Andrey Makhnach 5492b73322 Added tests to failing steps with arguments. 2013-09-27 11:09:33 +03:00
Andrey Makhnach f8f9a06e15 merged with olegpidsadnyi/pytest-bdd 2013-09-27 10:19:12 +03:00
Oleg Pidsadnyi e363a26ca7 tests fixed 2013-09-21 00:41:03 +02:00
Oleg Pidsadnyi 26d419173b wrong feature syntax tests are fixed 2013-09-21 00:36:19 +02:00
Oleg Pidsadnyi 5ce0272a9f wrong feature syntax tests are fixed 2013-09-21 00:35:02 +02:00
Oleg Pidsadnyi f6837b948c wrong order tests 2013-09-21 00:30:31 +02:00
Oleg Pidsadnyi c7957e694a tests fixed 2013-09-20 23:29:42 +02:00
Oleg Pidsadnyi 6cd91e6e75 given validation 2013-09-20 22:48:40 +02:00
Oleg Pidsadnyi e121f634ec print removed 2013-09-20 00:57:54 +02:00
Oleg Pidsadnyi 82398e8c3f tests added 2013-09-20 00:46:29 +02:00
Anatoly Bubenkov 1315ab19ee step arguments done, docs fixed 2013-09-19 00:43:06 +02:00