New submission from Karthikeyan Singaravelan <tir.kar...@gmail.com>:

I can reproduce frequently the failure of test_clean on my Mac machine. It 
checks for removal of foo_path. It's removed by Maildir.clean that removes 
files based on the access time as below. The test also does similar thing with 
os.utime(foo_path, (time.time() - 129600 - 2, foo_stat.st_mtime)) but I guess 
the file is not really deleted in some cases.

https://github.com/python/cpython/blob/7772b1af5ebc9d72d0cfc8332aea6b2143eafa27/Lib/mailbox.py#L482

def clean(self):
    """Delete old files in "tmp"."""
    now = time.time()
    for entry in os.listdir(os.path.join(self._path, 'tmp')):
        path = os.path.join(self._path, 'tmp', entry)
        if now - os.path.getatime(path) > 129600:   # 60 * 60 * 36
            os.remove(path)

$ ./python.exe -Wall -m test -R 3:3 -j 4 test_mailbox -m test_clean
0:00:00 load avg: 2.12 Run tests in parallel using 4 child processes
0:00:00 load avg: 2.12 [1/1/1] test_mailbox failed
beginning 6 repetitions
123456
.....test test_mailbox failed -- Traceback (most recent call last):
  File "/Users/kasingar/stuff/python/cpython/Lib/test/test_mailbox.py", line 
737, in test_clean
    self.assertFalse(os.path.exists(foo_path))
AssertionError: True is not false

== Tests result: FAILURE ==

1 test failed:
    test_mailbox

Total duration: 951 ms
Tests result: FAILURE

----------
components: Tests
messages: 358295
nosy: barry, maxking, r.david.murray, xtreak
priority: normal
severity: normal
status: open
title: TestMaildir.test_clean fails randomly under parallel tests
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39029>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to