Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-39488: skip bigfile test if not enough disk space #18261
Conversation
@@ -151,9 +151,23 @@ def test_seekable(self): | |||
self.assertTrue(f.seekable()) | |||
|
|||
|
|||
def skip_no_disk_space(): |
This comment has been minimized.
This comment has been minimized.
vstinner
Jan 29, 2020
Member
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)
.
This comment has been minimized.
This comment has been minimized.
giampaolo
Jan 29, 2020
Author
Contributor
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).
class TestCopyfile(LargeFileTest, unittest.TestCase): | ||
open = staticmethod(io.open) | ||
|
||
@skip_no_disk_space(os.getcwd(), size * 3) |
This comment has been minimized.
This comment has been minimized.
vstinner
Jan 30, 2020
Member
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().
This comment has been minimized.
This comment has been minimized.
class TestCopyfile(LargeFileTest, unittest.TestCase): | ||
open = staticmethod(io.open) | ||
|
||
@skip_no_disk_space(TESTFN, size * 3) |
This comment has been minimized.
This comment has been minimized.
vstinner
Jan 30, 2020
Member
Why is it *3? I count only two files: TESTFN and TESTFN2. Maybe add a comment explaining why it's *3?
@@ -200,6 +213,7 @@ def run(sock): | |||
self.thread.start() | |||
event.set() | |||
|
|||
@skip_no_disk_space(TESTFN, size * 3) |
giampaolo commentedJan 29, 2020
•
edited by bedevere-bot
https://bugs.python.org/issue39488
https://bugs.python.org/issue39488