Skip to content

Commit 4167093

Browse files
committed
Set up pytest marks for Nash algorithms
1 parent 2000cee commit 4167093

3 files changed

Lines changed: 33 additions & 9 deletions

File tree

.github/workflows/python.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
1111
strategy:
1212
matrix:
13-
python-version: ['3.9', '3.12']
13+
python-version: ['3.9', '3.13']
1414

1515
steps:
1616
- uses: actions/checkout@v4
@@ -21,10 +21,10 @@ jobs:
2121
- name: Set up dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install setuptools cython pytest wheel lxml numpy scipy
24+
pip install setuptools cython pytest pytest-skip-slow wheel lxml numpy scipy
2525
- name: Build source distribution
2626
run:
27-
python setup.py sdist
27+
python -m build
2828
- name: Build from source distribution
2929
run: |
3030
cd dist
@@ -37,7 +37,7 @@ jobs:
3737
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
3838
strategy:
3939
matrix:
40-
python-version: ['3.12']
40+
python-version: ['3.13']
4141

4242
steps:
4343
- uses: actions/checkout@v4
@@ -48,7 +48,7 @@ jobs:
4848
- name: Set up dependencies
4949
run: |
5050
python -m pip install --upgrade pip
51-
pip install cython pytest wheel lxml numpy scipy
51+
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy
5252
- name: Build extension
5353
run: |
5454
python -m pip install -v .
@@ -60,7 +60,7 @@ jobs:
6060
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
6161
strategy:
6262
matrix:
63-
python-version: ['3.12']
63+
python-version: ['3.13']
6464

6565
steps:
6666
- uses: actions/checkout@v4
@@ -71,7 +71,7 @@ jobs:
7171
- name: Set up dependencies
7272
run: |
7373
python -m pip install --upgrade pip
74-
pip install cython pytest wheel lxml numpy scipy
74+
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy
7575
- name: Build extension
7676
run: |
7777
python -m pip install -v .
@@ -83,7 +83,7 @@ jobs:
8383
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
8484
strategy:
8585
matrix:
86-
python-version: ['3.12']
86+
python-version: ['3.13']
8787

8888
steps:
8989
- uses: actions/checkout@v4
@@ -94,7 +94,7 @@ jobs:
9494
- name: Set up dependencies
9595
run: |
9696
python -m pip install --upgrade pip
97-
pip install cython pytest wheel lxml numpy scipy
97+
pip install cython pytest pytest-skip-slow wheel lxml numpy scipy
9898
- name: Build extension
9999
run: |
100100
python -m pip install -v .

pyproject.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,16 @@ indent-style = "space"
7070

7171
[tool.cython-lint]
7272
max-line-length = 99
73+
74+
75+
[tool.pytest.ini_options]
76+
addopts = "--strict-markers"
77+
markers = [
78+
"nash_enummixed_strategy: tests of enummixed_solve in strategies",
79+
"nash_lcp_strategy: tests of lcp_solve in strategies",
80+
"nash_lcp_behavior: tests of lcp_solve in behaviors",
81+
"nash_lp_strategy: tests of lp_solve in strategies",
82+
"nash_lp_behavior: tests of lp_solve in behaviors",
83+
"nash: all tests of Nash equilibrium solvers",
84+
"slow: all time-consuming tests",
85+
]

tests/test_nash.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def test_enummixed_strategy_double():
3232
# For floating-point results are not exact, so we skip testing exact values for now
3333

3434

35+
@pytest.mark.nash
36+
@pytest.mark.nash_enummixed_strategy
3537
def test_enummixed_strategy_rational():
3638
"""Test calls of enumeration of mixed strategy equilibria, rational precision."""
3739
game = games.read_from_file("poker.efg")
@@ -53,6 +55,8 @@ def test_lcp_strategy_double():
5355
# For floating-point results are not exact, so we skip testing exact values for now
5456

5557

58+
@pytest.mark.nash
59+
@pytest.mark.nash_lcp_strategy
5660
def test_lcp_strategy_rational():
5761
"""Test calls of LCP for mixed strategy equilibria, rational precision."""
5862
game = games.read_from_file("poker.efg")
@@ -74,6 +78,8 @@ def test_lcp_behavior_double():
7478
# For floating-point results are not exact, so we skip testing exact values for now
7579

7680

81+
@pytest.mark.nash
82+
@pytest.mark.nash_lcp_behavior
7783
def test_lcp_behavior_rational():
7884
"""Test calls of LCP for mixed behavior equilibria, rational precision."""
7985
game = games.read_from_file("poker.efg")
@@ -94,6 +100,8 @@ def test_lp_strategy_double():
94100
# For floating-point results are not exact, so we skip testing exact values for now
95101

96102

103+
@pytest.mark.nash
104+
@pytest.mark.nash_lp_strategy
97105
def test_lp_strategy_rational():
98106
"""Test calls of LP for mixed strategy equilibria, rational precision."""
99107
game = games.read_from_file("poker.efg")
@@ -115,6 +123,9 @@ def test_lp_behavior_double():
115123
# For floating-point results are not exact, so we skip testing exact values for now
116124

117125

126+
@pytest.mark.nash
127+
@pytest.mark.slow
128+
@pytest.mark.nash_lp_behavior
118129
def test_lp_behavior_rational():
119130
"""Test calls of LP for mixed behavior equilibria, rational precision."""
120131
game = games.read_from_file("poker.efg")

0 commit comments

Comments
 (0)