Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid test naming in --collect-only -q report when the test is not part of a class #6

Open
stas00 opened this issue Sep 16, 2020 · 0 comments

Comments

@stas00
Copy link

stas00 commented Sep 16, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant