From 9aed89548e2c34cede69c26c604c9e85a456b341 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sat, 28 Sep 2024 11:19:29 +0200 Subject: [PATCH] fix(test_static.py): fix Windows CPython 3.13 build (#2346) * chore: rename workflow files for consistency * chore: one more rename... * chore: create a way to reproduce windows build issue in CI * test(static): attempt to fix static route tests on Windows+py313 * chore: remove prototyping --- .github/workflows/cibuildwheel.yaml | 2 +- .../{tests-mailman.yaml => test-mailman.yaml} | 3 +- .github/workflows/test-wheels.yaml | 48 +++++++++++++++++++ .github/workflows/tests-emulated.yaml | 36 -------------- tests/test_static.py | 8 ++-- 5 files changed, 55 insertions(+), 42 deletions(-) rename .github/workflows/{tests-mailman.yaml => test-mailman.yaml} (92%) create mode 100644 .github/workflows/test-wheels.yaml delete mode 100644 .github/workflows/tests-emulated.yaml diff --git a/.github/workflows/cibuildwheel.yaml b/.github/workflows/cibuildwheel.yaml index c62b840af..b0337d802 100644 --- a/.github/workflows/cibuildwheel.yaml +++ b/.github/workflows/cibuildwheel.yaml @@ -112,7 +112,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.20.0 + uses: pypa/cibuildwheel@v2.21.1 env: CIBW_ARCHS_LINUX: all CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.name }} diff --git a/.github/workflows/tests-mailman.yaml b/.github/workflows/test-mailman.yaml similarity index 92% rename from .github/workflows/tests-mailman.yaml rename to .github/workflows/test-mailman.yaml index ccb6a00ec..ab69fedd5 100644 --- a/.github/workflows/tests-mailman.yaml +++ b/.github/workflows/test-mailman.yaml @@ -1,4 +1,5 @@ -name: Run tests (GNU Mailman 3) +# Test that the current dev branch does not break GNU Mailman 3. +name: test-mailman on: # Trigger the workflow on master but also allow it to run manually. diff --git a/.github/workflows/test-wheels.yaml b/.github/workflows/test-wheels.yaml new file mode 100644 index 000000000..3ccf2e360 --- /dev/null +++ b/.github/workflows/test-wheels.yaml @@ -0,0 +1,48 @@ +# Test various architectures by building out binaries with cibuildwheel. +name: test-wheels + +on: + # Trigger the workflow on master but also allow it to run manually. + workflow_dispatch: + push: + branches: + - master + +jobs: + test-emulated: + name: "cibuildwheel: ${{ matrix.platform.build }}" + runs-on: ${{ matrix.platform.os }} + strategy: + fail-fast: false + matrix: + platform: + - build: "cp313-manylinux_aarch64" + os: ubuntu-latest + emulation: true + - build: "cp313-manylinux_s390x" + os: ubuntu-latest + emulation: true + - build: "cp313-musllinux_x86_64" + os: ubuntu-latest + - build: "cp313-macosx_arm64" + os: macos-14 + - build: "cp313-win_amd64" + os: windows-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + if: ${{ matrix.platform.emulation }} + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.1 + env: + CIBW_ARCHS_LINUX: all + CIBW_BUILD: ${{ matrix.platform.build }} diff --git a/.github/workflows/tests-emulated.yaml b/.github/workflows/tests-emulated.yaml deleted file mode 100644 index 5cae65c21..000000000 --- a/.github/workflows/tests-emulated.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Run tests (emulated) - -on: - # Trigger the workflow on master but also allow it to run manually. - workflow_dispatch: - push: - branches: - - master - -jobs: - test-emulated: - name: "cibuildwheel: ${{ matrix.platform }}" - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - "cp312-manylinux_aarch64" - - "cp312-manylinux_s390x" - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.20.0 - env: - CIBW_ARCHS_LINUX: all - CIBW_BUILD: ${{ matrix.platform }} diff --git a/tests/test_static.py b/tests/test_static.py index 1b38d2e64..5830b904c 100644 --- a/tests/test_static.py +++ b/tests/test_static.py @@ -619,11 +619,11 @@ def test_file_closed(client, patch_open): assert patch_open.current_file.closed -def test_options_request(util, asgi, patch_open): +def test_options_request(client, patch_open): patch_open() - app = util.create_app(asgi, cors_enable=True) - app.add_static_route('/static', '/var/www/statics') - client = testing.TestClient(app) + + client.app.add_middleware(falcon.CORSMiddleware()) + client.app.add_static_route('/static', '/var/www/statics') resp = client.simulate_options( path='/static/foo/bar.txt',