Skip to content

Commit 3e380d1

Browse files
authored
Merge pull request #223 from mayeut/bump-test-sdist-python
chore(ci): bump `test_sdist` python from 3.11 to 3.12
2 parents 5a36116 + f704f43 commit 3e380d1

File tree

7 files changed

+33
-56
lines changed

7 files changed

+33
-56
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
strategy:
111111
fail-fast: false
112112
matrix:
113-
python: ["2.7", "3.6", "3.11"]
113+
python: ["2.7", "3.6", "3.12"]
114114

115115
steps:
116116
- uses: actions/checkout@v4

docs/update_ninja_version.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ Classic procedure:
4444
Updating README.rst - done
4545
Updating docs/update_ninja_version.rst
4646
Updating docs/update_ninja_version.rst - done
47-
Updating tests/test_distribution.py
48-
Updating tests/test_distribution.py - done
47+
Updating tests/test_ninja.py
48+
Updating tests/test_ninja.py - done
4949

5050

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

5454
release=1.11.1.g95dee.kitware.jobserver-1
5555
git checkout -b update-to-ninja-${release}
56-
git add NinjaUrls.cmake README.rst docs/update_ninja_version.rst tests/test_distribution.py
56+
git add NinjaUrls.cmake README.rst docs/update_ninja_version.rst tests/test_ninja.py
5757
git commit -m "Update to Ninja ${release}"
5858

5959
4. Create a `Pull Request`.

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def bump(session: nox.Session) -> None:
102102
files = (
103103
"NinjaUrls.cmake",
104104
"README.rst",
105-
"tests/test_distribution.py",
105+
"tests/test_ninja.py",
106106
"docs/update_ninja_version.rst",
107107
)
108108
session.run(

requirements-test.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
codecov>=2.0.5
21
coverage>=4.2
3-
flake8>=3.0.4
2+
importlib_metadata>=2.0
43
pytest>=4.5.0
54
pytest-cov>=2.7.1
6-
pytest-runner>=5.1
7-
pytest-virtualenv>=1.7.0
8-
virtualenv>=15.0.3

scripts/update_ninja_version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def update_tests(version):
173173
pattern = re.compile(r'expected_version = "\d+.\d+.\d+(\.[\w\-]+)*"')
174174
replacement = 'expected_version = "%s"' % version
175175
_update_file(os.path.join(
176-
ROOT_DIR, "tests/test_distribution.py"), pattern, replacement)
176+
ROOT_DIR, "tests/test_ninja.py"), pattern, replacement)
177177

178178

179179
def main():
@@ -214,7 +214,7 @@ def main():
214214
Complete! Now run:
215215
216216
git switch -c update-to-ninja-{release}
217-
git add -u NinjaUrls.cmake docs/index.rst README.rst tests/test_distribution.py docs/update_ninja_version.rst
217+
git add -u NinjaUrls.cmake docs/index.rst README.rst tests/test_ninja.py docs/update_ninja_version.rst
218218
git commit -m "Update to Ninja {release}"
219219
gh pr create --fill --body "Created by update_ninja_version.py"
220220
"""

tests/test_distribution.py

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

tests/test_ninja.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# -*- coding: utf-8 -*-
2+
import os
23
import subprocess
34
import sys
5+
import sysconfig
46

57
import pytest
8+
from importlib_metadata import distribution
69

710
import ninja
811

@@ -17,9 +20,30 @@ def _run(program, args):
1720
assert excinfo.value.code == 0
1821

1922

23+
def _get_scripts():
24+
dist = distribution("ninja")
25+
scripts_paths = [os.path.abspath(sysconfig.get_path("scripts", scheme)) for scheme in sysconfig.get_scheme_names()]
26+
scripts = []
27+
for file in dist.files:
28+
if os.path.abspath(str(file.locate().parent)) in scripts_paths:
29+
scripts.append(file.locate().resolve(strict=True))
30+
return scripts
31+
32+
2033
def test_ninja_module():
2134
_run("ninja", ["--version"])
2235

2336

2437
def test_ninja_package():
25-
subprocess.check_call([sys.executable, "-m", "ninja", "--version"])
38+
expected_version = "1.11.1.git.kitware.jobserver-1"
39+
output = subprocess.check_output([sys.executable, "-m", "ninja", "--version"]).decode("ascii")
40+
assert output.splitlines()[0] == expected_version
41+
42+
43+
def test_ninja_script():
44+
expected_version = "1.11.1.git.kitware.jobserver-1"
45+
scripts = _get_scripts()
46+
assert len(scripts) == 1
47+
assert scripts[0].stem == "ninja"
48+
output = subprocess.check_output([str(scripts[0]), "--version"]).decode("ascii")
49+
assert output.splitlines()[0] == expected_version

0 commit comments

Comments
 (0)