From c80b5b1e0f58e972e312b5835b8368d7847941b8 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Tue, 2 Apr 2024 15:11:37 -0600 Subject: [PATCH] Fix macOS spawning issue in tests, expand testing frameworks --- .github/workflows/run-crt-test.yml | 3 ++- .github/workflows/run-tests.yml | 4 ++-- tests/unit/test_compat.py | 8 ++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-crt-test.yml b/.github/workflows/run-crt-test.yml index 1e20b57f..85748d20 100644 --- a/.github/workflows/run-crt-test.yml +++ b/.github/workflows/run-crt-test.yml @@ -8,11 +8,12 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-latest, macOS-latest, windows-latest] steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index de4bb8ef..9678ca6f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,12 +10,12 @@ permissions: jobs: build: - - runs-on: ubuntu-latest + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-latest, macOS-latest, windows-latest] steps: - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 diff --git a/tests/unit/test_compat.py b/tests/unit/test_compat.py index f40a602a..0b44dd43 100644 --- a/tests/unit/test_compat.py +++ b/tests/unit/test_compat.py @@ -79,6 +79,14 @@ def test_non_file_like_obj(self): class TestBaseManager(unittest.TestCase): def create_pid_manager(self): + if sys.platform == "darwin": + # Starting in Python 3.8, the default multiprocessing + # moved from `fork` to `spawn` to account for how macOS + # handles (or doesn't) forking. Users who are hitting this + # issue _may_ consider changing the start_method after + # reviewing this issue. + # https://github.com/python/cpython/issues/77906 + multiprocessing.set_start_method("fork") class PIDManager(BaseManager): pass