`unittest` TestCase collection fails silently when there are unclear circular dependencies
See original GitHub issueHey! I have problem with collecting unittest/asynctest based test.
I’m trying to run tests TestCase from unittest/asynctest and have problem when I provide for example exact dir
pytest directory_name
then collecting works fine, it will collect correct test and run it but when I will run pytest without directory
pytest
it’s collecting same tests but in this case it skipps all of them becasue it has init method defined from testcase.
PytestCollectionWarning: cannot collect test class 'TestCase' because it has a __init__ constructor
but If I run it directly, by passing
pytest test_name.py
or pytest dir_name
it will run single test or in second case, it will collect correctly test from dir and run it
In every case the same test are collected but in one is skipped and in another it run normally.
also
https://docs.pytest.org/en/stable/unittest.html
it says that
pytest tests
should run unittest style test but it will work only if there are in test
dir, right?
Is it bug or missing configuration?
- pytest 6.2.2
- asynctest 0.13.0
- python 3.9.1
- osx Big Sur on m1
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Yes please, if a circular dependency in code somehow breaks collection, there should be a error at least
I wonder why pytest lacks it
Closing because we don’t have the needed information to resolve this, happy to reopen if that changes 😕