-
Notifications
You must be signed in to change notification settings - Fork 39
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
Flush mocks when pook.activate
used as a wrapper
#144
Comments
Note: You can also check |
Thanks again @shift0965, I've released your fix in https://github.com/h2non/pook/releases/tag/v2.1.1 🎉 |
Thanks!! Could you also help me release it on PyPI 🙏 |
Ah, apologies! I thought I had pushed it 🤦 It's there now, thanks very much for the ping! |
Description:
When using
pook.activate
as a decorator for test functions, existing mocks are not flushed before activating the mocks in each test. This can lead to test cases affecting each other, resulting in non-independent tests, which is a concern in test suites where each test should be isolated.Expected Behavior:
When
pook.activate
is used to wrap a test function, it should automatically flush all existing mocks both before activating the new mocks and after the test function completes. This would ensure that each test starts with a clean slate and works independently without being affected by mocks from previous test cases.Actual Behavior:
Currently, when
pook.activate
is used as a wrapper, it retains the mocks from previous tests, causing test cases to interfere with each other.Suggested Solution:
Flush mocks before activation and after the testing function
Example:
In this example, test_case_2 will fails if both test cases are run together but it will pass when run individually. This behavior makes debugging extremely difficult because the tests are not properly isolated, leading to inconsistent results.
The text was updated successfully, but these errors were encountered: