Skip to content

Commit 83d0f93

Browse files
authored
Add Windows and macOS test runs (#366)
2 parents c615a63 + 21aaa06 commit 83d0f93

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ name: "Run tests"
22
on: [pull_request, workflow_call]
33
jobs:
44
build:
5-
runs-on: ubuntu-latest
5+
runs-on: ${{ matrix.os }}
6+
strategy:
7+
matrix:
8+
os: [ubuntu-latest, windows-latest, macos-latest]
9+
env:
10+
SDL_AUDIODRIVER: dummy
11+
SDL_VIDEODRIVER: dummy
612
steps:
7-
- name: Install xvfb and pulseaudio
8-
run: |
9-
sudo apt update
10-
sudo apt install -y xvfb pulseaudio
1113
- uses: actions/checkout@v4
1214
- name: Set up Python 3.x
1315
uses: actions/setup-python@v5
@@ -25,13 +27,8 @@ jobs:
2527
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2628
# stricter tests for mission critical code
2729
flake8 --count src test
28-
- name: Run tests under xvfb
29-
run: |
30-
export XDG_RUNTIME_DIR="$RUNNER_TEMP"
31-
pulseaudio -D --start
32-
xvfb-run --auto-servernum pytest
33-
- name: Cleanup xvfb pidx
34-
uses: bcomnes/cleanup-xvfb@v1
30+
- name: Run tests
31+
run: pytest
3532
- uses: actions/upload-artifact@v4
3633
if: ${{ failure() }}
3734
with:

src/pgzero/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def load_and_run(path, *, fps: bool = False):
115115
src = f.read()
116116
except FileNotFoundError:
117117
raise NoMainModule(f"Error: {path} does not exist.")
118-
except IsADirectoryError:
118+
except (IsADirectoryError, PermissionError):
119119
name = os.path.basename(path)
120120
for candidate in (
121121
'__main__.py',

src/pgzero/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _ensure_save_path(cls):
6565
"""Ensure that the directory for all save game data exists."""
6666
try:
6767
os.makedirs(cls.STORAGE_DIR)
68-
except IsADirectoryError:
68+
except (IsADirectoryError, PermissionError):
6969
pass
7070
except FileExistsError:
7171
pass

0 commit comments

Comments
 (0)