Skip to content

Commit

Permalink
Disable saving tests when running actions on forks
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jun 26, 2024
1 parent 1553694 commit fa5dfae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ jobs:
with:
submodules: recursive
- name: Checkout game-test-files
if: github.repository == 'LagoLunatic/wwrando'
uses: actions/checkout@v4
with:
repository: LagoLunatic/game-test-files
path: game-test-files
token: ${{ secrets.GAME_TEST_FILES_TOKEN }}
- name: Extract test files
if: github.repository == 'LagoLunatic/wwrando'
run: |
7z x $PWD/game-test-files/files/GZLE01.7z -o$PWD/game-test-files/files
- name: Set up Python
Expand Down Expand Up @@ -96,7 +98,13 @@ jobs:
run: |
echo WW_GZLE01_STRIPPED_PATH=$PWD/game-test-files/files/GZLE01.iso >> .env
echo WW_RANDO_OUTPUT_DIR=$PWD/wwrando-output >> .env
- name: Test with pytest
- name: Test with pytest (with saving)
if: github.repository == 'LagoLunatic/wwrando'
run: |
pip install pytest pytest-cov
pytest test --cov --cov-report=html -m "not saving"
- name: Test with pytest (without saving)
if: github.repository != 'LagoLunatic/wwrando'
run: |
pip install pytest pytest-cov
pytest test --cov --cov-report=html
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ testpaths =
test
pythonpath =
test
markers =
saving: Tests reading and saving game files (deselect with '-m "not saving"')
8 changes: 8 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
from pathlib import Path

def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
for item in items:
if Path(item.fspath).parts[-1] == "test_save.py":
mark = pytest.mark.saving
item.add_marker(mark)

0 comments on commit fa5dfae

Please sign in to comment.