Skip to content

Commit 5f82992

Browse files
authored
Run without-future-annotations test through tox to include it in local coverage (#751)
1 parent 5fbb73f commit 5f82992

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,6 @@ repos:
111111
pass_filenames: false
112112
verbose: true
113113

114-
- id: test-without-future-annotations
115-
name: test-without-future-annotations
116-
entry: bash -c '
117-
set -e;
118-
if [ $(pip3 list 2>/dev/null | grep -F "$(pwd)" | grep -c ^jsonargparse) = 0 ]; then
119-
echo "$(tput setaf 6) Skipped, jsonargparse not installed as editable $(tput sgr0)";
120-
else
121-
TEST_DIR=$(mktemp -d -t _jsonargparse_tests_XXXXXX);
122-
cleanup () { rm -rf "$TEST_DIR"; };
123-
trap cleanup EXIT;
124-
cp jsonargparse_tests/*.py "$TEST_DIR";
125-
cd "$TEST_DIR";
126-
sed -i -e "/^from __future__ import annotations$/d" *.py;
127-
pytest $TEST_DIR;
128-
fi'
129-
stages: [pre-push]
130-
language: system
131-
pass_filenames: false
132-
verbose: true
133-
134114
- id: doctest
135115
name: sphinx-build -M doctest sphinx sphinx/_build sphinx/index.rst
136116
entry: bash -c '

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Fixed
2323
<https://github.com/omni-us/jsonargparse/pull/746>`__).
2424
- Introspection of postponed annotations from jax not working (`#749
2525
<https://github.com/omni-us/jsonargparse/pull/749>`__).
26+
- ``without-future-annotations`` test not included in local coverage (`#751
27+
<https://github.com/omni-us/jsonargparse/pull/751>`__).
2628

2729

2830
v4.40.1 (2025-07-24)

pyproject.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Villegas = "Villegas"
191191
[tool.tox]
192192
legacy_tox_ini = """
193193
[tox]
194-
envlist = py{38,39,310,311,312,313}-{all,no}-extras,omegaconf,pydantic-v1,without-pyyaml
194+
envlist = py{38,39,310,311,312,313}-{all,no}-extras,omegaconf,pydantic-v1,without-pyyaml,without-future-annotations
195195
skip_missing_interpreters = true
196196
197197
[testenv]
@@ -238,4 +238,18 @@ extras = test,coverage,all
238238
commands =
239239
pip uninstall -y argcomplete omegaconf pyyaml reconplogger responses ruyaml types-PyYAML
240240
python -m pytest {posargs}
241+
242+
[testenv:without-future-annotations]
243+
extras = test,coverage,all
244+
allowlist_externals = sh
245+
commands =
246+
sh -c "\
247+
rm -rf /tmp/_without_future_annotations; \
248+
mkdir /tmp/_without_future_annotations; \
249+
cp *.py /tmp/_without_future_annotations; \
250+
sed -i -e '/^from __future__ import annotations$/d' /tmp/_without_future_annotations/*.py; \
251+
"
252+
python -m pytest /tmp/_without_future_annotations {posargs}
253+
commands_post =
254+
sh -c "rm -rf /tmp/_without_future_annotations"
241255
"""

0 commit comments

Comments
 (0)