From 2813e94ca80c8e41caaa58ff90c063ca0a26a80c Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Thu, 30 Nov 2023 22:42:05 -0500 Subject: [PATCH 1/5] Add macOS test jobs to CI matrix This now tests on macOS in as well as Ubuntu and Windows. --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 3915296ef..273e63668 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "windows-latest"] + os: ["ubuntu-latest", "macos-latest", "windows-latest"] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false From 789baa1c205411545b1105035e773e795ab30302 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Thu, 30 Nov 2023 22:53:32 -0500 Subject: [PATCH 2/5] Use macOS 13 on CI "macos-latest" is currently macOS 12. Using macOS 13 may be faster. --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 273e63668..003ed92c1 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: ["ubuntu-latest", "macos-13", "windows-latest"] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - experimental: false From f6f335ffcd55af5367692d338d78cf0465c34514 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Thu, 30 Nov 2023 23:24:21 -0500 Subject: [PATCH 3/5] Temporarily break test_blocking_lock_file on Windows To compare how much extra wait time Windows and macOS usually need. --- test/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_util.py b/test/test_util.py index f1ce17bca..634bd765d 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -397,7 +397,7 @@ def test_blocking_lock_file(self): self.assertRaises(IOError, wait_lock._obtain_lock) elapsed = time.time() - start extra_time = 0.02 - if os.name == "nt" or sys.platform == "cygwin": + if sys.platform == "cygwin": # FIXME: Put back native Windows check. extra_time *= 6 # NOTE: Indeterministic failures without this... self.assertLess(elapsed, wait_time + extra_time) From c16e4f371b1ee193af92c4ef685315ca1d41e6e9 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 1 Dec 2023 00:33:50 -0500 Subject: [PATCH 4/5] Restore longer extra time for Windows, and add for macOS This undoes the testing breakage of test_blocking_lock_file for Windows, and gives macOS the same amount of extra time as Windows. I had expected that macOS, even though it needs more time than Ubuntu, might not need as much extra time as Windows. That turned out not to be the case, in the limited testing done so far on CI. Windows, while still slower than Ubuntu and still too slow to reliably pass the test_blocking_lock_file test, was usually faster than macOS and passed more often. These relative timings may turn out not to be a trend and only to apply to the current GHA runners. That's probably okay since the adjustment for macOS wasn't present before and is being added to allow newly introduced macOS CI test jobs to pass. That is all in regard to the very specific issue of the extra time required for the test_blocking_lock_file test after the lock, which makes an assertion about that not taking too long. Regarding the overall time of entire test jobs, macOS 13 seems to have usually been a little faster than macOS 12, so it is retained. Unlike "macos-latest", which currently is macOS 12, "macos-13" will never refer to a later version of the operating system, so the version given in the workflow should be revisited later, at or after the time "macos-latest" becomes a synonym of "macos-13". --- test/test_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_util.py b/test/test_util.py index 634bd765d..77332a49d 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -397,7 +397,7 @@ def test_blocking_lock_file(self): self.assertRaises(IOError, wait_lock._obtain_lock) elapsed = time.time() - start extra_time = 0.02 - if sys.platform == "cygwin": # FIXME: Put back native Windows check. + if os.name == "nt" or sys.platform == "cygwin" or sys.platform == "darwin": extra_time *= 6 # NOTE: Indeterministic failures without this... self.assertLess(elapsed, wait_time + extra_time) From d15f891c3127e6b855656b31e04bb1c089f8d54d Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 1 Dec 2023 01:07:34 -0500 Subject: [PATCH 5/5] macOS needs even more extra time in test_blocking_lock_file As seen in: https://github.com/EliahKagan/GitPython/actions/runs/7056321920/attempts/1 Usually an extra_time of 0.12 (6x) is sufficient for both Windows and macOS, but sometimes macOS needs even more, so this increases it to 0.18 (9x) for macOS. --- test/test_util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_util.py b/test/test_util.py index 77332a49d..428bd07c3 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -397,8 +397,10 @@ def test_blocking_lock_file(self): self.assertRaises(IOError, wait_lock._obtain_lock) elapsed = time.time() - start extra_time = 0.02 - if os.name == "nt" or sys.platform == "cygwin" or sys.platform == "darwin": - extra_time *= 6 # NOTE: Indeterministic failures without this... + if os.name == "nt" or sys.platform == "cygwin": + extra_time *= 6 # Without this, we get indeterministic failures on Windows. + elif sys.platform == "darwin": + extra_time *= 9 # The situation on macOS is similar, but with more delay. self.assertLess(elapsed, wait_time + extra_time) def test_user_id(self):