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

Fix a flaky test by cleaning a polluted state. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sturmianseq
Copy link

What is the purpose of the change

This PR is to fix a flaky test tests/test_propagation_logger.py::test_forcing_level_by_dict, which can fail after running tests/test_propagation_logger.py::test_forcing_level_by_level_name, but passes when run in isolation.

Reproduce the test failure

Run the following command:

python -m pytest tests/test_propagation_logger.py::test_forcing_level_by_level_name tests/test_propagation_logger.py::test_forcing_level_by_dict

Expected result

tests/test_propagation_logger.py::test_forcing_level_by_dict should pass after running tests/test_propagation_logger.py::test_forcing_level_by_level_name.

Actual result

E           Failed: DID NOT RAISE <class 'IndexError'>

tests/test_propagation_logger.py:116: Failed

Why it fails

propagation_logger is polluted after running tests/test_propagation_logger.py::test_forcing_level_by_level_name.

Fix

Reset propagation_logger at the beginning of tests/test_propagation_logger.py::test_forcing_level_by_dict

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

Successfully merging this pull request may close these issues.

1 participant