Skip to content

Commit

Permalink
Merge pull request #7 from kondratyev-nv/master
Browse files Browse the repository at this point in the history
Don't modify nodeid when plugin is disabled
  • Loading branch information
gwthm-in authored Mar 5, 2023
2 parents fd98ddb + cda6b68 commit 76f59bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytest_pspec/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def pytest_configure(config):


def pytest_collection_modifyitems(config, items):
if not config.option.pspec:
return

for item in items:
node = item.obj
parent = item.parent.obj
Expand Down
11 changes: 11 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ def test_a_feature_is_working():
expected = '\033[92m ✓ a feature is working\033[0m'
assert expected in result.stdout.str()

def test_should_not_modify_nodeid_when_disabled_test(self, testdir):
testdir.makepyfile("""
def test_a_feature_is_working():
assert True
""")

result = testdir.runpytest('-v')

expected = 'test_should_not_modify_nodeid_when_disabled_test.py::test_a_feature_is_working'
assert expected in result.stdout.str()

def test_should_print_a_red_failing_test(self, testdir):
testdir.makepyfile("""
def test_a_failed_test_of_a_feature():
Expand Down

0 comments on commit 76f59bf

Please sign in to comment.