From: Jukka Lehtosalo <jukka.lehtosalo@iki.fi>
Date: Fri, 2 Sep 2022 13:40:35 +0100
Subject: Work around mypyc test failures in CI (#13593)

Temporary workaround to #13572 that slows down mypyc tests.

Origin: upstream, https://github.com/python/mypy/commit/38eb6e8a05d201f0db94b62a69d5ee5ca68b3738
Bug-Upstream: https://github.com/python/mypy/issues/13572
---
 mypyc/test/test_run.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mypyc/test/test_run.py b/mypyc/test/test_run.py
index 4013c30..5f08152 100644
--- a/mypyc/test/test_run.py
+++ b/mypyc/test/test_run.py
@@ -8,6 +8,7 @@ import subprocess
 import contextlib
 import shutil
 import sys
+import time
 from typing import Any, Iterator, List, cast
 
 from mypy import build
@@ -160,6 +161,12 @@ class TestRun(MypycDataSuite):
             # new by distutils, shift the mtime of all of the
             # generated artifacts back by a second.
             fudge_dir_mtimes(WORKDIR, -1)
+            # On Ubuntu, changing the mtime doesn't work reliably. As
+            # a workaround, sleep.
+            #
+            # TODO: Figure out a better approach, since this slows down tests.
+            if sys.platform == "linux":
+                time.sleep(1.0)
 
             step += 1
             with chdir_manager('..'):
