diff options
author | Peter Pentchev <roam@ringlet.net> | 2023-10-19 23:28:46 +0300 |
---|---|---|
committer | Peter Pentchev <roam@ringlet.net> | 2023-10-19 23:28:46 +0300 |
commit | b96b5f3aebb74aa37d1815047429ac786923a250 (patch) | |
tree | 6fa6b951838aa08d4aef9c1f77663ad39eeaf953 | |
parent | 71db508630672f61915f076e2256439e5e26fca5 (diff) | |
parent | c612033533e4bb9393feb433e97bcacdac29652f (diff) |
Update upstream source from tag 'upstream/0.1.4'
Update to upstream version '0.1.4'
with Debian dir 2337a057a1d91d3ac693835864edd6b1c0f4b488
-rw-r--r-- | PKG-INFO | 15 | ||||
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | config/ruff-all/pyproject.toml | 1 | ||||
-rw-r--r-- | config/ruff-base/pyproject.toml | 3 | ||||
-rw-r--r-- | docs/changes.md | 34 | ||||
-rw-r--r-- | docs/index.md | 13 | ||||
-rw-r--r-- | docs/man/tox-stages.1 | 8 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | requirements/ruff.txt | 2 | ||||
-rw-r--r-- | src/selftest/__main__.py | 2 | ||||
-rw-r--r-- | src/test_stages/__init__.py | 2 | ||||
-rw-r--r-- | src/tox_trivtags/parse.py | 71 | ||||
-rw-r--r-- | tox.ini | 10 |
13 files changed, 95 insertions, 79 deletions
@@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: test_stages -Version: 0.1.3 +Version: 0.1.4 Summary: Group Tox, Nox, etc environments into stages, run them in parallel Project-URL: Homepage, https://devel.ringlet.net/devel/test-stages Project-URL: Changes, https://devel.ringlet.net/devel/test-stages/changes/ @@ -39,7 +39,7 @@ Requires-Dist: pyparsing<4,>=3 Requires-Dist: tomli<3,>=2; python_version < '3.11' Requires-Dist: utf8-locale<2,>=1 Provides-Extra: tox -Requires-Dist: tox<4,>=3; extra == 'tox' +Requires-Dist: tox<5,>=4; extra == 'tox' Description-Content-Type: text/markdown <!-- @@ -80,17 +80,6 @@ section of the `pyproject.toml` file: [tool.test-stages] stages = ["ruff and not @manual", "@check", "@tests"] -## Running Tox tests with a newer version of Tox if needed - -If the `tox.ini` file contains a `min_version` (or `minversion`) specification in -the `[tox]` section, the `test-stages` library must also be installed in -the virtual environment where Tox bootstraps the new version: - - [tox] - minversion = 4.1 - requires = - test-stages >= 0.1.3 - ## Author The `test-stages` library is developed by [Peter Pentchev][roam] in @@ -36,17 +36,6 @@ section of the `pyproject.toml` file: [tool.test-stages] stages = ["ruff and not @manual", "@check", "@tests"] -## Running Tox tests with a newer version of Tox if needed - -If the `tox.ini` file contains a `min_version` (or `minversion`) specification in -the `[tox]` section, the `test-stages` library must also be installed in -the virtual environment where Tox bootstraps the new version: - - [tox] - minversion = 4.1 - requires = - test-stages >= 0.1.3 - ## Author The `test-stages` library is developed by [Peter Pentchev][roam] in diff --git a/config/ruff-all/pyproject.toml b/config/ruff-all/pyproject.toml index d59603f..3463fb8 100644 --- a/config/ruff-all/pyproject.toml +++ b/config/ruff-all/pyproject.toml @@ -4,3 +4,4 @@ [tool.ruff] extend = "../ruff-base/pyproject.toml" select = ["ALL"] +preview = true diff --git a/config/ruff-base/pyproject.toml b/config/ruff-base/pyproject.toml index bba46dd..daf1352 100644 --- a/config/ruff-base/pyproject.toml +++ b/config/ruff-base/pyproject.toml @@ -19,6 +19,9 @@ ignore = [ "D213", ] +[tool.ruff.flake8-copyright] +notice-rgx = "(?x) SPDX-FileCopyrightText: \\s \\S" + [tool.ruff.isort] force-single-line = true known-first-party = ["test_stages", "tox_trivtags"] diff --git a/docs/changes.md b/docs/changes.md index 1cf8a57..5a25764 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -12,6 +12,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.4] - 2023-10-19 + +### Fixes + +- fix the rendering of long options in the `tox-stages` manual page + +### Additions + +- tox_trivtags: + - automatically tell a bootstrapped Tox to install a recent enough version of + `test-stages` into its own virtual environment so that it may output tags + +### Other changes + +- drop the documentation section on requiring `test-stages` in the Tox configuration +- build system: + - refer to Tox 4.x in the "tox" optional dependency group +- selftest: + - use `pathlib.Path.cwd()` instead of `pathlib.Path().resolve()` +- testing framework: + - Ruff: + - use Ruff 0.1.0 + - let it know how to check for our SPDX copyright tags + - enable its preview mode + - reuse: + - use reuse 2.x + - only run if a Git checkout subdirectory is present + - with the above in mind, add it to the list of default Tox environments + - mypy: + - do not install `tomli` in the virtual environment on recent Python versions + ## [0.1.3] - 2023-10-01 ### Fixes @@ -151,7 +182,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [ringlet-test-stages]: https://devel.ringlet.net/devel/test-stages/ "The Ringlet test-stages homepage" [tool-mkdocs]: https://www.mkdocs.org/ "Project documentation with Markdown" -[Unreleased]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.3...main +[Unreleased]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.4...main +[0.1.4]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.3...release%2F0.1.4 [0.1.3]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.2...release%2F0.1.3 [0.1.2]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.1...release%2F0.1.2 [0.1.1]: https://gitlab.com/ppentchev/test-stages/-/compare/release%2F0.1.0...release%2F0.1.1 diff --git a/docs/index.md b/docs/index.md index bb4a83d..9ea1fba 100644 --- a/docs/index.md +++ b/docs/index.md @@ -49,19 +49,6 @@ section of the `pyproject.toml` file: stages = ["ruff and not @manual", "@check", "@tests"] ``` -## Running Tox tests with a newer version of Tox if needed - -If the `tox.ini` file contains a `min_version` (or `minversion`) specification in -the `[tox]` section, the `test-stages` library must also be installed in -the virtual environment where Tox bootstraps the new version: - -``` ini -[tox] -minversion = 4.1 -requires = - test-stages >= 0.1.3 -``` - ## Author The `test-stages` library is developed by [Peter Pentchev][roam] in diff --git a/docs/man/tox-stages.1 b/docs/man/tox-stages.1 index 07a338e..8e05bb7 100644 --- a/docs/man/tox-stages.1 +++ b/docs/man/tox-stages.1 @@ -13,8 +13,8 @@ .Nm .Op Fl f Ar filename .Cm run -.Op Fl -arg Ar arg... | Fl A Ar arg... -.Op Fl -parallel Ar spec | Fl p Ar spec +.Op Fl Fl arg Ar arg... | Fl A Ar arg... +.Op Fl Fl parallel Ar spec | Fl p Ar spec .Op Ar stage... .Sh DESCRIPTION The @@ -79,11 +79,11 @@ The .Cm run subcommand accepts the following options: .Bl -tag -width indent -.It Fl -arg Ar argument | Fl A Ar argument +.It Fl Fl arg Ar argument | Fl A Ar argument Pass an additional command-line argument to each Tox invocation. This option may be specified more than once, and the arguments will be passed in the order given. -.It Fl -parallel Ar spec | Fl p Ar spec +.It Fl Fl parallel Ar spec | Fl p Ar spec Specify which stages to run in parallel. The .Ar spec diff --git a/pyproject.toml b/pyproject.toml index 56baaad..a1aa2cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ email = "roam@ringlet.net" trivtags = "tox_trivtags" [project.optional-dependencies] -tox = ["tox >= 3, < 4"] +tox = ["tox >= 4, < 5"] [project.scripts] tox-stages = "test_stages.tox_stages.__main__:main" diff --git a/requirements/ruff.txt b/requirements/ruff.txt index d45867f..4d07939 100644 --- a/requirements/ruff.txt +++ b/requirements/ruff.txt @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net> # SPDX-License-Identifier: BSD-2-Clause -ruff == 0.0.291 +ruff == 0.1.0 diff --git a/src/selftest/__main__.py b/src/selftest/__main__.py index eda699a..66dc1c0 100644 --- a/src/selftest/__main__.py +++ b/src/selftest/__main__.py @@ -144,7 +144,7 @@ def run_tox(testdir: pathlib.Path) -> None: def main() -> None: """Build a source distribution, extract it, run some tests.""" - srcdir: Final = pathlib.Path().resolve() + srcdir: Final = pathlib.Path.cwd() validate_srcdir(srcdir) with tempfile.TemporaryDirectory() as tempd_name: diff --git a/src/test_stages/__init__.py b/src/test_stages/__init__.py index 0a8a3c7..cebc7fc 100644 --- a/src/test_stages/__init__.py +++ b/src/test_stages/__init__.py @@ -2,4 +2,4 @@ # SPDX-License-Identifier: BSD-2-Clause """Run `tox` on several groups of environments, stopping on errors.""" -VERSION = "0.1.3" +VERSION = "0.1.4" diff --git a/src/tox_trivtags/parse.py b/src/tox_trivtags/parse.py index 289ef6a..108ab85 100644 --- a/src/tox_trivtags/parse.py +++ b/src/tox_trivtags/parse.py @@ -96,33 +96,46 @@ def parse_showconfig( "-e", "ALL", ] - lines: Final = subprocess.run( - tox_cmd, - check=True, - encoding="UTF-8", - env=env, - shell=False, # noqa: S603 - stdout=subprocess.PIPE, - ).stdout.splitlines() - # Drop the lines that Tox outputs at the start if it needs to bootstrap - # a more recent version due to a `tox.minversion` specification. - lines_real: Final = itertools.dropwhile(lambda line: not line.startswith("["), lines) - - cfgp: Final = configparser.ConfigParser(interpolation=None) - cfgp.read_string("\n".join(lines_real) + "\n") - - return { - name: TestenvTags( - cfg_name=cfg_name, - name=name, - tags=_parse_tags(tags), - ) - for cfg_name, name, tags in ( - (cfg_name, name, env["tags"]) - for cfg_name, name, env in ( - (cfg_name, remove_prefix(cfg_name, "testenv:"), env) - for cfg_name, env in cfgp.items() + + def parse_output() -> configparser.ConfigParser: + """Run Tox, parse its output as an INI-style file.""" + lines: Final = subprocess.run( + tox_cmd, + check=True, + encoding="UTF-8", + env=env, + shell=False, # noqa: S603 + stdout=subprocess.PIPE, + ).stdout.splitlines() + # Drop the lines that Tox outputs at the start if it needs to bootstrap + # a more recent version due to a `tox.minversion` specification. + lines_real: Final = itertools.dropwhile(lambda line: not line.startswith("["), lines) + + cfgp: Final = configparser.ConfigParser(interpolation=None) + cfgp.read_string("\n".join(lines_real) + "\n") + return cfgp + + def process_config(cfgp: configparser.ConfigParser) -> dict[str, TestenvTags]: + """Build the result dictionary.""" + return { + name: TestenvTags( + cfg_name=cfg_name, + name=name, + tags=_parse_tags(tags), + ) + for cfg_name, name, tags in ( + (cfg_name, name, env["tags"]) + for cfg_name, name, env in ( + (cfg_name, remove_prefix(cfg_name, "testenv:"), env) + for cfg_name, env in cfgp.items() + ) + if cfg_name != name ) - if cfg_name != name - ) - } + } + + cfgp_no_req: Final = parse_output() + if any("tags" in env for env in cfgp_no_req.values()): + return process_config(cfgp_no_req) + + tox_cmd.extend(["-x", "tox.requires=test-stages >= 0.1.3"]) + return process_config(parse_output()) @@ -7,6 +7,7 @@ envlist = ruff format mypy + reuse unit-tests-no-tox unit-tests-tox-3 unit-tests-tox-4 @@ -67,7 +68,7 @@ deps = -r requirements/selftest.txt -r requirements/test.txt mypy >= 1, < 2 - tomli >= 2, < 3 + tomli >= 2, < 3; python_version < '3.11' # There seems to be some misunderstanding between mypy 1.4.1 and click 8.1.4 click != 8.1.4 @@ -147,11 +148,12 @@ commands = skip_install = True tags = check - manual deps = - reuse >= 1, < 2 + reuse >= 2, < 3 +allowlist_externals = + sh commands = - reuse lint + sh -c 'if [ -d .git ]; then reuse lint; else echo skipped; fi' [testenv:docs] skip_install = True |