pytest-pspec
pytest-pspec copied to clipboard
Invalid test naming in --collect-only -q report when the test is not part of a class
When pytest-pspec is installed pytest --collect-only -q fails to deal with tests that have no classes, seems to be the case with unittest or without
Here is a simple test module with one normal test and one unittest:
cat <<EOT >> test_broken_collect.py
import unittest
def test_no_unittest(): pass
class TestSome(unittest.TestCase):
def test_this(self): pass
EOT
Let's collect:
pytest test_broken_collect.py --collect-only -q
Getting:
test_broken_collect.py::::test_no_unittest
test_broken_collect.py::TestSome::test_this
The first test item is bogus - it should be examples/seq2seq/test_broken_collect.py::test_no_unittest (i.e. 2 colons and not 4). If we feed it back to pytest it fails to run a test it reported it collected.
update: I first thought it had to do with mixing unittest, but it fails with just normal tests w/o classes too:
cat <<EOT >> test_broken_collect.py
def test_no_unittest(): pass
EOT
same problem, getting test_broken_collect.py::::test_no_unittest
pytest 6.0.1
Thanks.