Skip to content

Commit 280260d

Browse files
authored
chore(ci): bump test_sdist python from 3.11 to 3.12 (#423)
* chore(ci): bump `test_sdist` python from 3.11 to 3.12 * chore: remove test_distribution.py It was always skipped in CI tests and relies on plugins that do not support python 3.12. Remove the file and move the version check to test_cmake.
1 parent 8d1f63d commit 280260d

File tree

8 files changed

+37
-74
lines changed

8 files changed

+37
-74
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
strategy:
172172
fail-fast: false
173173
matrix:
174-
python: ["2.7", "3.6", "3.11"]
174+
python: ["2.7", "3.6", "3.12"]
175175

176176
steps:
177177
- uses: actions/checkout@v4

docs/update_cmake_version.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ Classic procedure:
4040
Updating docs/index.rst - done
4141
Updating README.rst
4242
Updating README.rst - done
43-
Updating tests/test_distribution.py
44-
Updating tests/test_distribution.py - done
43+
Updating tests/test_cmake.py
44+
Updating tests/test_cmake.py - done
4545

4646
3. Create a topic named `update-to-cmake-X.Y.Z` and commit the changes.
4747
For example::
4848

4949
release=3.27.8
5050
git switch -c update-to-cmake-$release
51-
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_distribution.py docs/update_cmake_version.rst
51+
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_cmake.py docs/update_cmake_version.rst
5252
git commit -m "Update to CMake $release"
5353

5454
4. Push the topic and create a `Pull Request`.

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def bump(session: nox.Session) -> None:
119119
"CMakeUrls.cmake",
120120
"docs/index.rst",
121121
"README.rst",
122-
"tests/test_distribution.py",
122+
"tests/test_cmake.py",
123123
"docs/update_cmake_version.rst",
124124
)
125125
_bump(session, "CMake", "kitware/cmake", "", "scripts/update_cmake_version.py", files)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ before-all = [
2020
before-build = "pip install -r requirements-repair.txt"
2121
repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
2222
test-extras = "test"
23-
test-command = "pytest --ignore={project}/tests/test_distribution.py {project}/tests"
23+
test-command = "pytest {project}/tests"
2424
build-verbosity = "1"
2525

2626
[tool.cibuildwheel.linux]

requirements-test.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
coverage>=4.2
2-
flake8>=3.0.4
3-
path.py>=11.5.0
2+
importlib_metadata>=2.0
43
pytest>=3.0.3
54
pytest-cov>=2.4.0
6-
pytest-runner>=2.9
7-
pytest-virtualenv>=1.7.0
8-
scikit-build>=0.10.0
9-
setuptools>=28.0.0
10-
virtualenv>=15.0.3
11-
wheel

scripts/update_cmake_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def update_tests(version):
184184
pattern = re.compile(r'expected_version = "\d.(\d)+.\d"')
185185
replacement = 'expected_version = "%s"' % version
186186
_update_file(
187-
os.path.join(ROOT_DIR, "tests/test_distribution.py"), pattern, replacement
187+
os.path.join(ROOT_DIR, "tests/test_cmake.py"), pattern, replacement
188188
)
189189

190190

@@ -228,7 +228,7 @@ def main():
228228
Complete! Now run:
229229
230230
git switch -c update-to-cmake-{release}
231-
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_distribution.py docs/update_cmake_version.rst
231+
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_cmake.py docs/update_cmake_version.rst
232232
git commit -m "Update to CMake {release}"
233233
gh pr create --fill --body "Created by update_cmake_version.py"
234234
"""

tests/test_cmake.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# -*- coding: utf-8 -*-
2+
import os
3+
import subprocess
4+
import sysconfig
25
import textwrap
36

47
import pytest
8+
from importlib_metadata import distribution
59

610
import cmake
711

812
from . import push_argv
913

14+
all_tools = pytest.mark.parametrize("tool", ["cmake", "cpack", "ctest"])
15+
1016

1117
def _run(program, args):
1218
func = getattr(cmake, program)
@@ -16,10 +22,9 @@ def _run(program, args):
1622
assert excinfo.value.code == 0
1723

1824

19-
def test_cmake_module():
20-
_run("cmake", ["--version"])
21-
_run("cpack", ["--version"])
22-
_run("ctest", ["--version"])
25+
@all_tools
26+
def test_cmake_module(tool):
27+
_run(tool, ["--version"])
2328

2429

2530
def test_cmake_https(tmpdir):
@@ -43,3 +48,22 @@ def test_cmake_https(tmpdir):
4348
))
4449

4550
_run("cmake", ["-DTMP_DIR:PATH=%s" % str(tmpdir), "-P", str(test_script)])
51+
52+
53+
def _get_scripts():
54+
dist = distribution("cmake")
55+
scripts_paths = [os.path.abspath(sysconfig.get_path("scripts", scheme)) for scheme in sysconfig.get_scheme_names()]
56+
scripts = []
57+
for file in dist.files:
58+
if os.path.abspath(str(file.locate().parent)) in scripts_paths:
59+
scripts.append(file.locate().resolve(strict=True))
60+
return scripts
61+
62+
63+
@all_tools
64+
def test_cmake_script(tool):
65+
expected_version = "3.27.8"
66+
scripts = [script for script in _get_scripts() if script.stem == tool]
67+
assert len(scripts) == 1
68+
output = subprocess.check_output([str(scripts[0]), "--version"]).decode("ascii")
69+
assert output.splitlines()[0] == "{} version {}".format(tool, expected_version)

tests/test_distribution.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)