-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Updated the test for extract_zipped_paths to run correctly if test_utils.py is changed #6889
base: main
Are you sure you want to change the base?
Conversation
…ils.py is changed
The tmpdir fixture used by this test generates a random test directory every time it runs and cleans it up after the test is finished. I'm not sure how you're encountering the failure you describe and there's certainly not enough detail here to help debug this further. |
Steps to reproduce this error:
|
I believe the correct fix here is to switch to |
Gotcha, I'll give it a shot. |
Hey @sigmavirus24 , I've updated the tests in this file that were using ![]() |
Hey! So I was playing around with requests and pytest and trying to see how unit tests work. While messing around with the tests cases in
test_utils.py
, I ran into a weird error, a completely unrelated unit test began to fail!This test turned out to be the test for the the function
extract_zipped_paths
inutils.py
. It seems that this function tries to extract a zipped file to a specific location, but doesn't do so if a file already exists at that location.In the unit test for this function, the test file itself is being used to validate whether the file is properly extracted post zipping. However, after running the test suite once, the zipped file is never replaced again! This led to newer versions of this file being compared with an older version, which ultimately caused the test case to fail in the
filecmp
assertion.Instead of me having to
rm -rf
it every time, I decided to include a minor cleanup step in the test case itself. Hope this helps out any future devs!Note: I'm open to other suggestions as well. I tried to keep the underlying code/functionality as unchanged as possible, another approach could be to make a separate file just to test out this function? Could be a randomly generated file during tests, or a fixed one in the main repo as well.