-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Child class setUpTestData is not called when time_machine is used as a class decorator for Django tests #402
Comments
Aww dammit. Class decorators are hard to get right. Can you try recreating this in a test case in time-machine’s test suite? Rather than using |
@adamchainz Thank you for the quick response and for the library :) |
Hi! I added a small failing test, I hope it'll help! |
Fixed in #404 which has been released. |
Thank you for the fix! |
Python Version
3.11
pytest Version
No response
Package Version
2.13.0
Description
Here is a repository with example: https://github.com/vkhudiakova/time-machine-bug
If I use
time_machine
as a class decorator for the base class, that is inherited from Django TestCase, then the childsetUpTestData
method is not called.Expected result:
Test outputs:
Running both base and child classes' setUpTestData methods.
Actual result
Test outputs only
Base class method
If @time_machine decorator is removed from the class, the test works as expected.
The text was updated successfully, but these errors were encountered: