Skip to content

Commit ce866e2

Browse files
committed
try fix python version restriction on tests, add optional cache clearing to CI
1 parent fc34132 commit ce866e2

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ on:
1414
required: true
1515
default: false
1616
type: boolean
17+
clear_cache:
18+
description: 'Clear GitHub Actions cache.'
19+
required: true
20+
default: false
21+
type: boolean
1722
jobs:
1823
linux:
1924
runs-on: ubuntu-latest
@@ -27,6 +32,10 @@ jobs:
2732
COVERAGE_FILE: linux-py${{ matrix.python-version }}.coverage
2833

2934
steps:
35+
- name: Clear GitHub Actions cache
36+
if: ${{ github.event.inputs.clear_cache == 'true' }}
37+
run: sudo rm -rf /opt/hostedtoolcache
38+
3039
- uses: actions/checkout@v4
3140
- name: Set up Python ${{ matrix.python-version }}
3241
id: sp
@@ -79,6 +88,7 @@ jobs:
7988

8089
steps:
8190
- name: Clear GitHub Actions cache
91+
if: ${{ github.event.inputs.clear_cache == 'true' }}
8292
run: sudo rm -rf /Users/runner/hostedtoolcache
8393

8494
- uses: actions/checkout@v4
@@ -132,6 +142,9 @@ jobs:
132142
COVERAGE_FILE: windows-py${{ matrix.python-version }}.coverage
133143

134144
steps:
145+
- name: Clear GitHub Actions cache
146+
if: ${{ github.event.inputs.clear_cache == 'true' }}
147+
run: Remove-Item -Recurse -Force C:\hostedtoolcache
135148
- uses: actions/checkout@v4
136149
- name: Set up Python ${{ matrix.python-version }}
137150
id: sp

tests/examples/test_examples.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ def test_howto_symmetry():
4141
from tests.examples import howto_symmetry
4242

4343

44+
@pytest.mark.skipif(sys.version_info < (3, 10), reason="requires Python 3.10 or higher")
4445
def test_howto_symmetric_overload():
4546
from tests.examples import howto_symmetric_overload
4647

4748

49+
@pytest.mark.skipif(sys.version_info < (3, 11), reason="requires Python 3.11 or higher")
4850
def test_howto_verify_unique():
4951
with pytest.raises(ValueError):
5052
from tests.examples import howto_verify_unique

0 commit comments

Comments
 (0)