-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-39488: skip bigfile test if not enough disk space #18261
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
Conversation
Lib/test/test_largefile.py
Outdated
| self.assertTrue(f.seekable()) | ||
|
|
||
|
|
||
| def skip_no_disk_space(): |
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.
I would prefer to pass explicitly a path, and call it inside the test, not outside (decorator).
Well, like a regular function :-) skip_no_disk_space(path, required).
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.
I would prefer to pass explicitly a path
Agree. Done.
and call it inside the test, not outside (decorator).
The check is executed right before running the test (and not on module import). Or at least, I guess that is your concern (it was mine too).
Lib/test/test_largefile.py
Outdated
| class TestCopyfile(LargeFileTest, unittest.TestCase): | ||
| open = staticmethod(io.open) | ||
|
|
||
| @skip_no_disk_space(os.getcwd(), size * 3) |
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.
os.getcwd() can be different when the function is defined and when the test is executed. I suggested to call skip_no_disk_space() inside the function. Something like:
def test_it(self):
skip_no_disk_space(TESTFN, size * 3)
...
TESTFN is usually relative. I'm not sure if skip_no_disk_space() should be made absolute using os.path.abspath().
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.
Good point. I used os.path.realpath instead.
Lib/test/test_largefile.py
Outdated
| class TestCopyfile(LargeFileTest, unittest.TestCase): | ||
| open = staticmethod(io.open) | ||
|
|
||
| @skip_no_disk_space(TESTFN, size * 3) |
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.
Why is it *3? I count only two files: TESTFN and TESTFN2. Maybe add a comment explaining why it's *3?
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.
It's just for extra safety. The required exact disk space would be (file size * 2) (aka 4.7G), but just in case something else writes on disk (especially on builtbots) I opted for (file size * 3) (around 7.2 GB).
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.
I added a comment:
# Exact required disk space would be (size * 2), but let's give it a
# bit more tolerance.
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.
If size2 is enough, I suggest to use size2.5 for safety rather than size*3 which is quite huge.
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.
Makes sense. Done.
Lib/test/test_largefile.py
Outdated
| self.thread.start() | ||
| event.set() | ||
|
|
||
| @skip_no_disk_space(TESTFN, size * 3) |
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.
Same question here :-)
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.
Would you mind to copy/paste the command here (and also replace size * 3 with size * 2.5)?
|
Thanks @giampaolo! I tested manually your PR and it works as expected. I merged your PR immediately, since I'm still getting https://bugs.python.org/issue39488 failure frequently on buildbots. Let's see if it's enough to fix these buildbots. |
|
Let's see. =) |
https://bugs.python.org/issue39488
https://bugs.python.org/issue39488