-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
tests: Use temporary directories in unit tests #3377
tests: Use temporary directories in unit tests #3377
Conversation
This will have conflicts with #3373, so it should be reviewed/merged after that one is complete. |
Conflicts resolved, this should be ready. |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3377 +/- ##
===========================================
+ Coverage 99.56% 99.58% +0.01%
===========================================
Files 253 254 +1
Lines 19561 19817 +256
===========================================
+ Hits 19476 19734 +258
+ Misses 85 83 -2
☔ View full report in Codecov by Sentry. |
Lychee error is unrelated to this change |
@Saransh-cpp Can this be removed so that these files do not keep getting created when I test? |
Sorry for the delay, @kratman, I'll review this before the end of this week. The extra files should not be a problem given that they should be ignored by git? Is there a specific redundant file that is not being ignored in |
None are missed by gitignore, just they exist until I run a cleanup command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, looks amazing, @kratman!
Description
The unit tests leave a large number of files behind in the git repo. This change will make the tests use temporary directories when creating files.
I used the tempfile module in python. There are a few other ways to do this, and I believe the preferred method is to use pytest. However, since pytest does not appear to be used, I went with tempfile as the easy solution.
Type of change
Minor fix in the tests.
Key checklist:
$ pre-commit run
(or$ nox -s pre-commit
) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)$ python run-tests.py --all
(or$ nox -s tests
)$ python run-tests.py --doctest
(or$ nox -s doctests
)You can run integration tests, unit tests, and doctests together at once, using
$ python run-tests.py --quick
(or$ nox -s quick
).Further checks: