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

Rewrite handler tests #299

Merged
merged 7 commits into from
Nov 5, 2023
Merged

Rewrite handler tests #299

merged 7 commits into from
Nov 5, 2023

Conversation

janosh
Copy link
Member

@janosh janosh commented Nov 4, 2023

The tests in custodian/vasp/tests/test_handlers.py are laden with order-dependent side effects. Running all tests in that file does not leave the test_files/ unchanged. Large numbers of files are modified and added while tests run and again deleted at the end... but only if all tests pass. Failing tests leave behind dirty files in the repo that then cause subsequent test runs to fail that were previously passing.

The right way to run IO-heavy tests like in Custodian is to move everything into temporary dirs that are auto-cleaned by the OS and can't affect anything inside the repo.

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c053811) 65.92% compared to head (08cdcb8) 64.86%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #299      +/-   ##
==========================================
- Coverage   65.92%   64.86%   -1.07%     
==========================================
  Files          51       51              
  Lines        5641     5465     -176     
==========================================
- Hits         3719     3545     -174     
+ Misses       1922     1920       -2     
Files Coverage Δ
custodian/vasp/tests/test_handlers.py 100.00% <100.00%> (+0.21%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@janosh
Copy link
Member Author

janosh commented Nov 4, 2023

Ran out of time. Only ones still missing are VaspErrorHandlerTest, UnconvergedErrorHandlerTest.

@janosh janosh added tests Test all the things DX Developer experience labels Nov 4, 2023
@Andrew-S-Rosen
Copy link
Member

@janosh: Thank you for doing this valuable cleanup. I had thought about splitting these up into a greater number of individual tests and using pytests's tmpdir fixture, but this looks like it works well too.

@janosh janosh merged commit 133865e into master Nov 5, 2023
3 checks passed
@janosh janosh deleted the refactor-handler-tests branch November 5, 2023 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer experience tests Test all the things
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants