diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65306e7a..8dc5948a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -111,26 +111,6 @@ repos: pass_filenames: false verbose: true - - id: test-without-future-annotations - name: test-without-future-annotations - entry: bash -c ' - set -e; - if [ $(pip3 list 2>/dev/null | grep -F "$(pwd)" | grep -c ^jsonargparse) = 0 ]; then - echo "$(tput setaf 6) Skipped, jsonargparse not installed as editable $(tput sgr0)"; - else - TEST_DIR=$(mktemp -d -t _jsonargparse_tests_XXXXXX); - cleanup () { rm -rf "$TEST_DIR"; }; - trap cleanup EXIT; - cp jsonargparse_tests/*.py "$TEST_DIR"; - cd "$TEST_DIR"; - sed -i -e "/^from __future__ import annotations$/d" *.py; - pytest $TEST_DIR; - fi' - stages: [pre-push] - language: system - pass_filenames: false - verbose: true - - id: doctest name: sphinx-build -M doctest sphinx sphinx/_build sphinx/index.rst entry: bash -c ' diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a7022f15..c56dff82 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -23,6 +23,8 @@ Fixed `__). - Introspection of postponed annotations from jax not working (`#749 `__). +- ``without-future-annotations`` test not included in local coverage (`#751 + `__). v4.40.1 (2025-07-24) diff --git a/pyproject.toml b/pyproject.toml index 5e92a567..71449d49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -191,7 +191,7 @@ Villegas = "Villegas" [tool.tox] legacy_tox_ini = """ [tox] -envlist = py{38,39,310,311,312,313}-{all,no}-extras,omegaconf,pydantic-v1,without-pyyaml +envlist = py{38,39,310,311,312,313}-{all,no}-extras,omegaconf,pydantic-v1,without-pyyaml,without-future-annotations skip_missing_interpreters = true [testenv] @@ -238,4 +238,18 @@ extras = test,coverage,all commands = pip uninstall -y argcomplete omegaconf pyyaml reconplogger responses ruyaml types-PyYAML python -m pytest {posargs} + +[testenv:without-future-annotations] +extras = test,coverage,all +allowlist_externals = sh +commands = + sh -c "\ + rm -rf /tmp/_without_future_annotations; \ + mkdir /tmp/_without_future_annotations; \ + cp *.py /tmp/_without_future_annotations; \ + sed -i -e '/^from __future__ import annotations$/d' /tmp/_without_future_annotations/*.py; \ + " + python -m pytest /tmp/_without_future_annotations {posargs} +commands_post = + sh -c "rm -rf /tmp/_without_future_annotations" """