pytest-dev / pytest-dev/pytest-django
setUpClass is not called with either pytest>4.1.1 or pytest-django>3.4.6
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
This is similar to #710 and #624
These 2 combinations work for me on python2:
pytest==4.1.1
pytest-django==3.5.1
pytest==4.6.4
pytest-django==3.4.6
But I cannot run the 2 libraries together on their latest release as in one test method out of a test suite with more than 5000 unit tests it occurs that the setUpClass method for the one test is then not called. The setUpClass is defined in a widely used mixin class (not inheriting from a TestClass base) and works everywhere else.
It is really weird how two testcases seem to disturb one another but it does not make any sense to me:
Here a quick description of my scenario:
mixin.py
class MyMixin() with a setUpClass
firstmodule.py:
class FirstTestCase(MyMixin) with test_foo
secondmodule.py
from firstmodule import FirstTestCase <---- when commenting this out my setUpClass gets run again for FirstTestCase::test_foo
class OtherModulesTestCase(FirstTestCase)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the stated pytest and pytest-django version combinations, using mixin.py, firstmodule.py, and secondmodule.py as the minimal scenario. Trace how importing FirstTestCase and subclassing it affects setUpClass; done means the method is reliably called for FirstTestCase::test_foo in the affected combinations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100