Skip to content

Commit c3088b2

Browse files
Merge pull request #1 from sliwinski-milosz/fix_tags_tests
In tests use -m instead of -k for running tests by marker expressions
2 parents 56f7acc + 07efb55 commit c3088b2

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ scenario test, so we can use standard test selection:
741741

742742
.. code-block:: bash
743743
744-
py.test -k "backend and login and successful"
744+
py.test -m "backend and login and successful"
745745
746746
The feature and scenario markers are not different from standard pytest markers, and the `@` symbol is stripped out
747747
automatically to allow test selector expressions. If you want to have bdd-related tags to be distinguishable from the

tests/feature/test_tags.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ def test():
1515

1616
assert test.__scenario__.tags == set(['scenario_tag_1', 'scenario_tag_2'])
1717
assert test.__scenario__.feature.tags == set(['feature_tag_1', 'feature_tag_2'])
18-
19-
assert getattr(test, 'scenario_tag_1')
20-
assert getattr(test, 'scenario_tag_2')
21-
22-
assert getattr(test, 'feature_tag_1')
23-
assert getattr(test, 'feature_tag_2')
24-
2518
test(request)
2619

2720

@@ -50,18 +43,18 @@ def i_have_bar():
5043
5144
scenarios('test.feature')
5245
""")
53-
result = testdir.runpytest('-k', 'scenario_tag_10 and not scenario_tag_01', '-vv').parseoutcomes()
46+
result = testdir.runpytest('-m', 'scenario_tag_10 and not scenario_tag_01', '-vv').parseoutcomes()
5447
assert result['passed'] == 1
5548
assert result['deselected'] == 1
5649

57-
result = testdir.runpytest('-k', 'scenario_tag_01 and not scenario_tag_10', '-vv').parseoutcomes()
50+
result = testdir.runpytest('-m', 'scenario_tag_01 and not scenario_tag_10', '-vv').parseoutcomes()
5851
assert result['passed'] == 1
5952
assert result['deselected'] == 1
6053

61-
result = testdir.runpytest('-k', 'feature_tag_1', '-vv').parseoutcomes()
54+
result = testdir.runpytest('-m', 'feature_tag_1', '-vv').parseoutcomes()
6255
assert result['passed'] == 2
6356

64-
result = testdir.runpytest('-k', 'feature_tag_10', '-vv').parseoutcomes()
57+
result = testdir.runpytest('-m', 'feature_tag_10', '-vv').parseoutcomes()
6558
assert result['deselected'] == 2
6659

6760

0 commit comments

Comments
 (0)