Skip to content

Commit 57e14c4

Browse files
committed
macOS test fix: key _resolve_shim_target off is_symlink + switch Linux CI to self-hosted
1. ``tests/test_playwrightprovider.py::_resolve_shim_target``: on macOS ``$TMPDIR`` lives under ``/var/folders/...`` → ``/private/var/...``, so ``shim.resolve()`` always differs from ``shim`` even for a plain regular file. The previous ``resolved != shim`` short-circuit skipped the shell-script parsing and returned the shim path itself. Key the branch off ``is_symlink()`` instead so the shell-script case (macOS ``.app`` bundle, where a plain symlink would break dyld's ``@executable_path``-relative Framework loading) actually parses the ``exec '<path>'`` line. 2. Switch Linux CI jobs (precheck, discover-*, build matrix Ubuntu entries, live-integration Linux entries, deploy-pages, release) from ``ubuntu-latest`` to the org's new self-hosted Linux runner. macOS matrix entries keep ``macOS-latest`` since the self-hosted runner is x64 Linux only.
1 parent 29d2fe5 commit 57e14c4

4 files changed

Lines changed: 21 additions & 19 deletions

File tree

.github/workflows/deploy-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
build:
19-
runs-on: ubuntu-latest
19+
runs-on: self-hosted
2020
timeout-minutes: 20
2121
steps:
2222
- name: Checkout
@@ -48,7 +48,7 @@ jobs:
4848
environment:
4949
name: github-pages
5050
url: ${{ steps.deployment.outputs.page_url }}
51-
runs-on: ubuntu-latest
51+
runs-on: self-hosted
5252
needs: build
5353
timeout-minutes: 20
5454
steps:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919

2020
jobs:
2121
release-state:
22-
runs-on: ubuntu-latest
22+
runs-on: self-hosted
2323
timeout-minutes: 20
2424
steps:
2525
- uses: actions/checkout@v6

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency:
1919

2020
jobs:
2121
precheck:
22-
runs-on: ubuntu-latest
22+
runs-on: self-hosted
2323
timeout-minutes: 20
2424

2525
steps:
@@ -49,7 +49,7 @@ jobs:
4949

5050
discover-standard-tests:
5151
needs: precheck
52-
runs-on: ubuntu-latest
52+
runs-on: self-hosted
5353
timeout-minutes: 20
5454
outputs:
5555
test-files: ${{ steps.set-matrix.outputs.test-files }}
@@ -88,9 +88,9 @@ jobs:
8888
max-parallel: 20
8989
matrix:
9090
target:
91-
- os: ubuntu-latest
91+
- os: self-hosted
9292
python_version: '3.11'
93-
- os: ubuntu-latest
93+
- os: self-hosted
9494
python_version: '3.14'
9595
- os: macOS-latest
9696
python_version: '3.13'
@@ -219,7 +219,7 @@ jobs:
219219
220220
discover-live-tests:
221221
needs: precheck
222-
runs-on: ubuntu-latest
222+
runs-on: self-hosted
223223
timeout-minutes: 20
224224
outputs:
225225
live-tests: ${{ steps.set-matrix.outputs.live-tests }}
@@ -239,9 +239,9 @@ jobs:
239239
needs_docker=true
240240
fi
241241
242-
os_targets="ubuntu-latest macOS-latest"
242+
os_targets="self-hosted macOS-latest"
243243
if grep -q "@pytest.mark.docker_required" "$test_file" || grep -q "@pytest.mark.root_required" "$test_file" || grep -q 'skipif("darwin"' "$test_file"; then
244-
os_targets="ubuntu-latest"
244+
os_targets="self-hosted"
245245
elif grep -q 'require_tool("brew")' "$test_file" && ! grep -q 'require_tool("apt-get")' "$test_file" && ! grep -q "operations.apt.packages" "$test_file" && ! grep -q "ansible.builtin.apt" "$test_file"; then
246246
os_targets="macOS-latest"
247247
fi

tests/test_playwrightprovider.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ def _resolve_shim_target(shim: Path) -> Path:
1414
1515
On Linux the shim is a symlink, so ``.resolve()`` naturally follows
1616
it. On macOS the shim is a shell script that ``exec``s the binary
17-
inside a ``.app`` bundle (a symlink would leave the browser launching
18-
without bundle context), so ``.resolve()`` just returns the script
19-
path. Parse the ``exec <path>`` line to recover the target in that
20-
case.
17+
inside a ``.app`` bundle (a direct symlink breaks dyld's
18+
``@executable_path``-relative Framework loading), so ``.resolve()``
19+
just returns the script path itself. Parse the ``exec <path>`` line
20+
to recover the target in that case. We key off ``is_symlink()``
21+
rather than comparing ``shim == shim.resolve()`` because macOS
22+
``$TMPDIR`` lives under ``/var/folders/...`` → ``/private/var/...``,
23+
so ``resolve()`` always differs from the input even for plain files.
2124
"""
22-
resolved = shim.resolve()
23-
if resolved != shim:
24-
return resolved
25+
if shim.is_symlink():
26+
return shim.resolve()
2527
try:
2628
script = shim.read_text(encoding="utf-8")
2729
except OSError:
28-
return resolved
30+
return shim.resolve()
2931
match = re.search(r"exec '([^']+)'", script)
3032
if not match:
31-
return resolved
33+
return shim.resolve()
3234
return Path(match.group(1)).resolve()
3335

3436

0 commit comments

Comments
 (0)