Merge pull request #287 from sliwinski-milosz/fix_tags_tests

In tests use -m instead of -k for running tests by marker expressions
This commit is contained in:
Florian Bruhin 2019-01-13 11:52:16 +01:00 committed by GitHub
commit 6db3496ad2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View File

@ -741,7 +741,7 @@ scenario test, so we can use standard test selection:
.. code-block:: bash
py.test -k "backend and login and successful"
py.test -m "backend and login and successful"
The feature and scenario markers are not different from standard pytest markers, and the `@` symbol is stripped out
automatically to allow test selector expressions. If you want to have bdd-related tags to be distinguishable from the

View File

@ -15,13 +15,6 @@ def test_tags(request):
assert test.__scenario__.tags == set(['scenario_tag_1', 'scenario_tag_2'])
assert test.__scenario__.feature.tags == set(['feature_tag_1', 'feature_tag_2'])
assert getattr(test, 'scenario_tag_1')
assert getattr(test, 'scenario_tag_2')
assert getattr(test, 'feature_tag_1')
assert getattr(test, 'feature_tag_2')
test(request)
@ -50,18 +43,18 @@ def test_tags_selector(testdir):
scenarios('test.feature')
""")
result = testdir.runpytest('-k', 'scenario_tag_10 and not scenario_tag_01', '-vv').parseoutcomes()
result = testdir.runpytest('-m', 'scenario_tag_10 and not scenario_tag_01', '-vv').parseoutcomes()
assert result['passed'] == 1
assert result['deselected'] == 1
result = testdir.runpytest('-k', 'scenario_tag_01 and not scenario_tag_10', '-vv').parseoutcomes()
result = testdir.runpytest('-m', 'scenario_tag_01 and not scenario_tag_10', '-vv').parseoutcomes()
assert result['passed'] == 1
assert result['deselected'] == 1
result = testdir.runpytest('-k', 'feature_tag_1', '-vv').parseoutcomes()
result = testdir.runpytest('-m', 'feature_tag_1', '-vv').parseoutcomes()
assert result['passed'] == 2
result = testdir.runpytest('-k', 'feature_tag_10', '-vv').parseoutcomes()
result = testdir.runpytest('-m', 'feature_tag_10', '-vv').parseoutcomes()
assert result['deselected'] == 2