Skip to content

Commit ed57f1c

Browse files
authored
Merge pull request #129 from sbidoul/test-py312
Test with python 3.12
2 parents 009efcd + 2d74b30 commit ed57f1c

File tree

6 files changed

+59
-22
lines changed

6 files changed

+59
-22
lines changed

.github/workflows/ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
python-version: "3.8"
3131
python: python
3232
- os: "windows-latest"
33-
python-version: "3.11"
33+
python-version: "3.12"
3434
python: python
3535
# macos
3636
- os: "macos-latest"
@@ -43,7 +43,7 @@ jobs:
4343
python-version: "3.8"
4444
python: python
4545
- os: "macos-latest"
46-
python-version: "3.11"
46+
python-version: "3.12"
4747
python: python
4848
# ubuntu
4949
- os: ubuntu-20.04
@@ -67,6 +67,9 @@ jobs:
6767
- os: ubuntu-latest
6868
python-version: "3.11"
6969
python: python
70+
- os: ubuntu-latest
71+
python-version: "3.12"
72+
python: python
7073
steps:
7174
- uses: "actions/checkout@v3"
7275
- uses: "actions/setup-python@v4"

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers = [
2222
"Programming Language :: Python :: 3.9",
2323
"Programming Language :: Python :: 3.10",
2424
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
2526
]
2627
requires-python = ">=3.8"
2728
dependencies=[

tests/conftest.py

+33-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
@pytest.fixture
11-
def virtualenv_python(tmp_path):
11+
def virtualenv_python(tmp_path, testpkgs):
1212
"""Return a python executable path within an isolated virtualenv, using a pip
1313
version that has the new resolver."""
1414
venv = tmp_path / "venv"
@@ -18,7 +18,21 @@ def virtualenv_python(tmp_path):
1818
else:
1919
python = venv / "bin" / "python"
2020
# use latest pip
21-
subprocess.check_call([str(python), "-m", "pip", "install", "-U", "pip"])
21+
subprocess.check_call(
22+
[
23+
str(python),
24+
"-m",
25+
"pip",
26+
"install",
27+
"--no-index",
28+
"--find-links",
29+
testpkgs,
30+
"-U",
31+
"pip",
32+
"setuptools",
33+
"wheel",
34+
]
35+
)
2236
return str(python)
2337

2438

@@ -70,6 +84,20 @@ def testpkgs(tmp_path_factory):
7084

7185
testpkgs_dir = tmp_path_factory.mktemp("testpkgs")
7286

87+
# Download some wheels so we can build pyproject-based packages without network.
88+
subprocess.check_call(
89+
[
90+
sys.executable,
91+
"-m",
92+
"pip",
93+
"wheel",
94+
"setuptools",
95+
"wheel",
96+
"--wheel-dir",
97+
str(testpkgs_dir),
98+
]
99+
)
100+
73101
for testpkg_kw in testpkgs_kw:
74102
setup_py_dir = tmp_path_factory.mktemp("testpkg")
75103
(setup_py_dir / "setup.py").write_text(
@@ -82,26 +110,14 @@ def testpkgs(tmp_path_factory):
82110
"-m",
83111
"pip",
84112
"wheel",
85-
"--no-build-isolation",
113+
"--no-index",
114+
"--find-links",
115+
str(testpkgs_dir),
86116
"--no-deps",
87117
str(setup_py_dir),
88118
"--wheel-dir",
89119
str(testpkgs_dir),
90120
],
91121
)
92122

93-
# Download some wheels so we can build pyproject-based packages without network.
94-
subprocess.check_call(
95-
[
96-
sys.executable,
97-
"-m",
98-
"pip",
99-
"wheel",
100-
"setuptools",
101-
"wheel",
102-
"--wheel-dir",
103-
str(testpkgs_dir),
104-
]
105-
)
106-
107123
return testpkgs_dir.as_uri()

tests/test_pip_list_json.py

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
)
5656
],
5757
)
58+
@pytest.mark.skipif(
59+
sys.version_info >= (3, 12),
60+
reason="pip-list-json.py not used in python 3.12+",
61+
)
5862
def test_pip_list_json(
5963
to_install, expected, virtualenv_python_with_pytest_cov, testpkgs
6064
):

tests/test_sanity.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def test_sanity_pip_version(virtualenv_python, capsys):
3131
assert "works best with pip>=20.1" in captured.err
3232

3333

34+
@pytest.mark.skipif(
35+
sys.version_info >= (3, 12),
36+
reason="All pip versions that support Python 3.12 have pip inspect",
37+
)
3438
def test_sanity_pkg_resources(virtualenv_python, capsys):
3539
assert check_env(virtualenv_python)
3640
subprocess.check_call([virtualenv_python, "-m", "pip", "install", "-q", "pip<22.2"])
@@ -43,11 +47,19 @@ def test_sanity_pkg_resources(virtualenv_python, capsys):
4347
assert "pkg_resources is not available" in captured.err
4448

4549

50+
@pytest.mark.skipif(
51+
sys.version_info >= (3, 12),
52+
reason=(
53+
"All pip versions that support Python 3.12 have do not do setup.py install "
54+
"so checking for the presence of wheel is not required."
55+
),
56+
)
4657
def test_sanity_wheel(virtualenv_python, capsys):
4758
assert check_env(virtualenv_python)
4859
subprocess.check_call([virtualenv_python, "-m", "pip", "install", "-q", "pip<23.1"])
4960
subprocess.check_call([virtualenv_python, "-m", "pip", "uninstall", "-qy", "wheel"])
50-
# wheel is not strictly required, although pip works better with it
61+
# wheel is not strictly required, although older pip versions did work better with
62+
# it. Recent pip versions do not use setup.py install so wheel is not required.
5163
assert check_env(virtualenv_python)
5264
captured = capsys.readouterr()
5365
assert "wheel is not available" in captured.err

tox.ini

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py27,py36,py37,py38,py39,py310,py311,mypy,twine_check
2+
envlist = py27,py36,py37,py38,py39,py310,py311,py312,mypy,twine_check
33
isolated_build = true
44

55
[gh-actions]
@@ -10,7 +10,8 @@ python =
1010
3.8: py38,mypy
1111
3.9: py39,mypy
1212
3.10: py310,mypy
13-
3.11: py311,mypy,twine_check
13+
3.11: py311,mypy
14+
3.12: py312,mypy,twine_check
1415

1516
[testenv]
1617
extras = test

0 commit comments

Comments
 (0)