Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): bump test_sdist python from 3.11 to 3.12 #423

Merged
merged 2 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["2.7", "3.6", "3.11"]
python: ["2.7", "3.6", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions docs/update_cmake_version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ Classic procedure:
Updating docs/index.rst - done
Updating README.rst
Updating README.rst - done
Updating tests/test_distribution.py
Updating tests/test_distribution.py - done
Updating tests/test_cmake.py
Updating tests/test_cmake.py - done

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

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

4. Push the topic and create a `Pull Request`.
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def bump(session: nox.Session) -> None:
"CMakeUrls.cmake",
"docs/index.rst",
"README.rst",
"tests/test_distribution.py",
"tests/test_cmake.py",
"docs/update_cmake_version.rst",
)
_bump(session, "CMake", "kitware/cmake", "", "scripts/update_cmake_version.py", files)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before-all = [
before-build = "pip install -r requirements-repair.txt"
repair-wheel-command = "python scripts/repair_wheel.py -w {dest_dir} {wheel}"
test-extras = "test"
test-command = "pytest --ignore={project}/tests/test_distribution.py {project}/tests"
test-command = "pytest {project}/tests"
build-verbosity = "1"

[tool.cibuildwheel.linux]
Expand Down
9 changes: 1 addition & 8 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
coverage>=4.2
flake8>=3.0.4
path.py>=11.5.0
importlib_metadata>=2.0
pytest>=3.0.3
pytest-cov>=2.4.0
pytest-runner>=2.9
pytest-virtualenv>=1.7.0
scikit-build>=0.10.0
setuptools>=28.0.0
virtualenv>=15.0.3
wheel
4 changes: 2 additions & 2 deletions scripts/update_cmake_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def update_tests(version):
pattern = re.compile(r'expected_version = "\d.(\d)+.\d"')
replacement = 'expected_version = "%s"' % version
_update_file(
os.path.join(ROOT_DIR, "tests/test_distribution.py"), pattern, replacement
os.path.join(ROOT_DIR, "tests/test_cmake.py"), pattern, replacement
)


Expand Down Expand Up @@ -228,7 +228,7 @@ def main():
Complete! Now run:

git switch -c update-to-cmake-{release}
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_distribution.py docs/update_cmake_version.rst
git add -u CMakeUrls.cmake docs/index.rst README.rst tests/test_cmake.py docs/update_cmake_version.rst
git commit -m "Update to CMake {release}"
gh pr create --fill --body "Created by update_cmake_version.py"
"""
Expand Down
32 changes: 28 additions & 4 deletions tests/test_cmake.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# -*- coding: utf-8 -*-
import os
import subprocess
import sysconfig
import textwrap

import pytest
from importlib_metadata import distribution

import cmake

from . import push_argv

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


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


def test_cmake_module():
_run("cmake", ["--version"])
_run("cpack", ["--version"])
_run("ctest", ["--version"])
@all_tools
def test_cmake_module(tool):
_run(tool, ["--version"])


def test_cmake_https(tmpdir):
Expand All @@ -43,3 +48,22 @@ def test_cmake_https(tmpdir):
))

_run("cmake", ["-DTMP_DIR:PATH=%s" % str(tmpdir), "-P", str(test_script)])


def _get_scripts():
dist = distribution("cmake")
scripts_paths = [os.path.abspath(sysconfig.get_path("scripts", scheme)) for scheme in sysconfig.get_scheme_names()]
scripts = []
for file in dist.files:
if os.path.abspath(str(file.locate().parent)) in scripts_paths:
scripts.append(file.locate().resolve(strict=True))
return scripts


@all_tools
def test_cmake_script(tool):
expected_version = "3.27.8"
scripts = [script for script in _get_scripts() if script.stem == tool]
assert len(scripts) == 1
output = subprocess.check_output([str(scripts[0]), "--version"]).decode("ascii")
assert output.splitlines()[0] == "{} version {}".format(tool, expected_version)
54 changes: 0 additions & 54 deletions tests/test_distribution.py

This file was deleted.

Loading