pytest
pytest copied to clipboard
pytest main does not detect some invalid nodeid names
Test scenario
test_file.py
import pytest
@pytest.mark.parametrize("bar", [1,2,3])
def test_foo(bar):
print(bar)
The following invalid nodeid is accepted by pytest instead of printing an error
$ pytest "test_file.py[foobar]" -q
... [100%]
3 passed in 0.04s
Expected
Similar to specifying wrong path/dir/parameterized nodeid an error should be printed instead of running all the tests in the given file
$ pytest "test_file.py[foobar]" -q
no tests ran in 0.01s
ERROR: file or directory not found: test_hello.py[foobar]