[New-bugs-announce] [issue35458] test_shutil.test_disk_usage() randomly fails when tests are run in parallel
STINNER Victor
report at bugs.python.org
Tue Dec 11 05:37:38 EST 2018
New submission from STINNER Victor <vstinner at redhat.com>:
Extract of the test:
usage = shutil.disk_usage(os.path.dirname(__file__))
self.assertEqual(usage, shutil.disk_usage(__file__))
The test fails if another process creates or removes data on the disk partition. IMHO "self.assertEqual(usage, shutil.disk_usage(__file__))" must be removed, it cannot be reliable without mocking os.statvfs() / nt._getdiskusage().
Even if tests are run sequentially, the test can fail if a program creates a file between the two lines of code, the test cannot be reliable.
https://buildbot.python.org/all/#/builders/85/builds/1882
FAIL: test_disk_usage (test.test_shutil.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/test/test_shutil.py", line 1366, in test_disk_usage
self.assertEqual(usage, shutil.disk_usage(__file__))
AssertionError: usage(total=1925696024576, used=1793793806336, free=131902218240) != usage(total=1925696024576, used=1793793818624, free=131902205952)
----------
components: Tests
messages: 331601
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_shutil.test_disk_usage() randomly fails when tests are run in parallel
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35458>
_______________________________________
More information about the New-bugs-announce
mailing list