Skip to content
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 @@ -108,7 +108,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_ninja_version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ Classic procedure:
Updating README.rst - done
Updating docs/update_ninja_version.rst
Updating docs/update_ninja_version.rst - done
Updating tests/test_distribution.py
Updating tests/test_distribution.py - done
Updating tests/test_ninja.py
Updating tests/test_ninja.py - done


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

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

4. 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 @@ -102,7 +102,7 @@ def bump(session: nox.Session) -> None:
files = (
"NinjaUrls.cmake",
"README.rst",
"tests/test_distribution.py",
"tests/test_ninja.py",
"docs/update_ninja_version.rst",
)
session.run(
Expand Down
6 changes: 1 addition & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
codecov>=2.0.5
coverage>=4.2
flake8>=3.0.4
importlib_metadata>=2.0
pytest>=4.5.0
pytest-cov>=2.7.1
pytest-runner>=5.1
pytest-virtualenv>=1.7.0
virtualenv>=15.0.3
4 changes: 2 additions & 2 deletions scripts/update_ninja_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def update_tests(version):
pattern = re.compile(r'expected_version = "\d+.\d+.\d+(\.[\w\-]+)*"')
replacement = 'expected_version = "%s"' % version
_update_file(os.path.join(
ROOT_DIR, "tests/test_distribution.py"), pattern, replacement)
ROOT_DIR, "tests/test_ninja.py"), pattern, replacement)


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

git switch -c update-to-ninja-{release}
git add -u NinjaUrls.cmake docs/index.rst README.rst tests/test_distribution.py docs/update_ninja_version.rst
git add -u NinjaUrls.cmake docs/index.rst README.rst tests/test_ninja.py docs/update_ninja_version.rst
git commit -m "Update to Ninja {release}"
gh pr create --fill --body "Created by update_ninja_version.py"
"""
Expand Down
43 changes: 0 additions & 43 deletions tests/test_distribution.py

This file was deleted.

26 changes: 25 additions & 1 deletion tests/test_ninja.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# -*- coding: utf-8 -*-
import os
import subprocess
import sys
import sysconfig

import pytest
from importlib_metadata import distribution

import ninja

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


def _get_scripts():
dist = distribution("ninja")
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


def test_ninja_module():
_run("ninja", ["--version"])


def test_ninja_package():
subprocess.check_call([sys.executable, "-m", "ninja", "--version"])
expected_version = "1.11.1.git.kitware.jobserver-1"
output = subprocess.check_output([sys.executable, "-m", "ninja", "--version"]).decode("ascii")
assert output.splitlines()[0] == expected_version


def test_ninja_script():
expected_version = "1.11.1.git.kitware.jobserver-1"
scripts = _get_scripts()
assert len(scripts) == 1
assert scripts[0].stem == "ninja"
output = subprocess.check_output([str(scripts[0]), "--version"]).decode("ascii")
assert output.splitlines()[0] == expected_version