From af0ad6e757c43adce5d50bdbe70effbd4b213a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Mon, 22 Jul 2024 13:03:07 +0200 Subject: [PATCH] gh-111051: [tests] Wait a second to support filesystems with low-resolution mtime (GH-121959) (cherry picked from commit cad11a2bdceb6d4683ae5654ce555cdf5f191217) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Langa --- Lib/test/test_pdb.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 8654d8e66f7e64..9b2c885ed67f85 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -3416,10 +3416,12 @@ def test_file_modified_after_execution(self): print("hello") """ + # the time.sleep is needed for low-resolution filesystems like HFS+ commands = """ filename = $_frame.f_code.co_filename f = open(filename, "w") f.write("print('goodbye')") + import time; time.sleep(1) f.close() ll """ @@ -3429,10 +3431,12 @@ def test_file_modified_after_execution(self): self.assertIn("was edited", stdout) def test_file_modified_after_execution_with_multiple_instances(self): + # the time.sleep is needed for low-resolution filesystems like HFS+ script = """ import pdb; pdb.Pdb().set_trace() with open(__file__, "w") as f: f.write("print('goodbye')\\n" * 5) + import time; time.sleep(1) import pdb; pdb.Pdb().set_trace() """