Skip to content

Commit 8a68c07

Browse files
authored
Split installation of tests into separate wheel file (#843)
1 parent 819846d commit 8a68c07

File tree

9 files changed

+68
-4
lines changed

9 files changed

+68
-4
lines changed

.bumpversion.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ serialize =
99
{major}.{minor}.{patch}
1010

1111
[bumpversion:file:jsonargparse/__init__.py]
12+
13+
[bumpversion:file:jsonargparse_tests/__init__.py]

.github/workflows/tests.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ jobs:
138138
run: |
139139
pip install -U build
140140
python -m build
141+
cd jsonargparse_tests
142+
python -m build --wheel
143+
mv dist/*.whl ../dist/
141144
- uses: actions/upload-artifact@v4
142145
with:
143146
name: package
@@ -159,13 +162,13 @@ jobs:
159162
- name: Test without optional dependencies and without pyyaml
160163
run: |
161164
cd dist
162-
pip install $(ls *.whl)[test-no-urls]
165+
pip install $(ls jsonargparse-*.whl)[test-no-urls] $(ls jsonargparse_tests-*.whl)
163166
pip uninstall -y pyyaml
164167
python -m jsonargparse_tests
165168
- name: Test with all optional dependencies
166169
run: |
167170
cd dist
168-
pip install $(ls *.whl)[test,all]
171+
pip install $(ls jsonargparse-*.whl)[test,all]
169172
python -m jsonargparse_tests
170173
171174
doctest:

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ repos:
7373
else
7474
python3 -m build --wheel;
7575
twine check dist/*.whl;
76+
cd jsonargparse_tests;
77+
python3 -m build --wheel;
78+
twine check dist/*.whl;
7679
fi'
7780
language: system
7881
pass_filenames: false

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ The semantic versioning only considers the public API as described in
1212
paths are considered internals and can change in minor and patch releases.
1313

1414

15+
v4.47.0 (unreleased)
16+
--------------------
17+
18+
Changed
19+
^^^^^^^
20+
- Tests are no longer installed by default, there is a separate
21+
``jsonargparse_tests`` wheel file for that (`#843
22+
<https://github.com/omni-us/jsonargparse/pull/843>`__).
23+
24+
1525
v4.46.0 (2026-02-02)
1626
--------------------
1727

CONTRIBUTING.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,19 @@ runs some additional tests.
109109
tox # Run tests using tox on available python versions
110110
pytest # Run tests using pytest on the python of the environment
111111
pytest --cov # Run tests and generate coverage report
112-
python -m jsonargparse_tests # Run tests on installed package (requires pytest and pytest-subtests)
113112
pre-commit run -a --hook-stage pre-push # Run pre-push git hooks (tests, doctests, mypy, coverage)
114113
114+
Tests can be run in any environment without the source code. Before v4.47.0, the
115+
tests were included in the main package. Since v4.47.0, they are provided in a
116+
separate package. Prefer installing the tests package with the same version as
117+
the main package. For example, for v4.47.0 run:
118+
119+
.. code-block:: bash
120+
121+
pip install jsonargparse_tests==4.47.0
122+
python -m jsonargparse_tests
123+
124+
115125
Coverage
116126
--------
117127

jsonargparse_tests/LICENSE.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE.rst

jsonargparse_tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
if "omegaconf" in loaders:
1010
loaders["yaml"] = loaders["omegaconf"]
1111
warnings.warn("Running all tests with omegaconf as the yaml loader.")
12+
13+
__version__ = "4.46.0"

jsonargparse_tests/pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
6+
[project]
7+
name = "jsonargparse-tests"
8+
dynamic = ["version"]
9+
description = "Tests for jsonargparse package."
10+
authors = [
11+
{name = "Mauricio Villegas", email = "mauricio@omnius.com"},
12+
]
13+
license = "MIT"
14+
license-files = ["LICENSE.rst"]
15+
16+
dependencies = [
17+
"jsonargparse[test-no-urls]",
18+
]
19+
20+
[project.urls]
21+
GitHub = "https://github.com/omni-us/jsonargparse"
22+
23+
24+
[tool.setuptools]
25+
packages = ["jsonargparse_tests"]
26+
27+
[tool.setuptools.package-dir]
28+
"jsonargparse_tests" = "."
29+
30+
[tool.setuptools.dynamic]
31+
version = {attr = "jsonargparse_tests.__version__"}

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Codecov = "https://codecov.io/gh/omni-us/jsonargparse"
139139

140140
[tool.setuptools]
141141
platforms = ["Any"]
142-
packages = ["jsonargparse", "jsonargparse_tests"]
142+
packages = ["jsonargparse"]
143143

144144
[tool.setuptools.dynamic]
145145
version = {attr = "jsonargparse.__version__"}
@@ -211,6 +211,7 @@ setenv =
211211
212212
[testenv:pydantic-v1]
213213
extras = coverage
214+
deps = ./jsonargparse_tests
214215
commands =
215216
# Test with pydantic<2
216217
python -c "\
@@ -242,6 +243,7 @@ commands =
242243
243244
[testenv:without-future-annotations]
244245
extras = test,coverage,all
246+
deps = ./jsonargparse_tests
245247
allowlist_externals = sh
246248
commands =
247249
sh -c "\

0 commit comments

Comments
 (0)