Skip to content

Commit 0e6e328

Browse files
authored
Python 3.11 compatibility
Closes #69
1 parent e046cb0 commit 0e6e328

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ jobs:
1818
"windows-py38",
1919
"windows-py39",
2020
"windows-py310",
21+
"windows-py311",
2122

2223
"ubuntu-py37",
2324
"ubuntu-py38",
2425
"ubuntu-py39",
2526
"ubuntu-py310",
27+
"ubuntu-py311",
2628
]
2729

2830
include:
@@ -42,6 +44,10 @@ jobs:
4244
python: "3.10"
4345
os: windows-latest
4446
tox_env: "py310"
47+
- name: "windows-py311"
48+
python: "3.11-dev"
49+
os: windows-latest
50+
tox_env: "py311"
4551

4652
- name: "ubuntu-py37"
4753
python: "3.7"
@@ -59,11 +65,15 @@ jobs:
5965
python: "3.10"
6066
os: ubuntu-latest
6167
tox_env: "py310"
68+
- name: "ubuntu-py311"
69+
python: "3.11-dev"
70+
os: ubuntu-latest
71+
tox_env: "py311"
6272

6373
steps:
64-
- uses: actions/checkout@v1
74+
- uses: actions/checkout@v2
6575
- name: Set up Python
66-
uses: actions/setup-python@v1
76+
uses: actions/setup-python@v2
6777
with:
6878
python-version: ${{ matrix.python }}
6979
- name: Install tox

tests/test_subtests.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import pytest
44

5+
IS_PY311 = sys.version_info[:2] >= (3, 11)
6+
57

68
@pytest.mark.parametrize("mode", ["normal", "xdist"])
79
class TestFixture:
@@ -137,13 +139,14 @@ def test_foo(self):
137139
@pytest.mark.parametrize("runner", ["unittest", "pytest-normal", "pytest-xdist"])
138140
def test_simple_terminal_normal(self, simple_script, testdir, runner):
139141

142+
suffix = ".test_foo" if IS_PY311 else ""
140143
if runner == "unittest":
141144
result = testdir.run(sys.executable, simple_script)
142145
result.stderr.fnmatch_lines(
143146
[
144-
"FAIL: test_foo (__main__.T) [custom] (i=1)",
147+
f"FAIL: test_foo (__main__.T{suffix}) [custom] (i=1)",
145148
"AssertionError: 1 != 0",
146-
"FAIL: test_foo (__main__.T) [custom] (i=3)",
149+
f"FAIL: test_foo (__main__.T{suffix}) [custom] (i=3)",
147150
"AssertionError: 1 != 0",
148151
"Ran 1 test in *",
149152
"FAILED (failures=2)",
@@ -171,14 +174,15 @@ def test_simple_terminal_normal(self, simple_script, testdir, runner):
171174
@pytest.mark.parametrize("runner", ["unittest", "pytest-normal", "pytest-xdist"])
172175
def test_simple_terminal_verbose(self, simple_script, testdir, runner):
173176

177+
suffix = ".test_foo" if IS_PY311 else ""
174178
if runner == "unittest":
175179
result = testdir.run(sys.executable, simple_script, "-v")
176180
result.stderr.fnmatch_lines(
177181
[
178-
"test_foo (__main__.T) ... ",
179-
"FAIL: test_foo (__main__.T) [custom] (i=1)",
182+
f"test_foo (__main__.T{suffix}) ... ",
183+
f"FAIL: test_foo (__main__.T{suffix}) [custom] (i=1)",
180184
"AssertionError: 1 != 0",
181-
"FAIL: test_foo (__main__.T) [custom] (i=3)",
185+
f"FAIL: test_foo (__main__.T{suffix}) [custom] (i=3)",
182186
"AssertionError: 1 != 0",
183187
"Ran 1 test in *",
184188
"FAILED (failures=2)",

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py37,py38,py39,py310
2+
envlist = py37,py38,py39,py310,py311
33

44
[testenv]
55
passenv = USER USERNAME TRAVIS PYTEST_ADDOPTS

0 commit comments

Comments
 (0)