Fix handling of tox 4 provision without tox minversion

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2240590

The added test actually blows up without the fix with both tox 4 or tox 3,
so perhaps this bug also existed with tox 3.
This commit is contained in:
Miro Hrončok 2023-09-25 14:32:43 +02:00
parent 15acb6ee5b
commit 089e2518ea
3 changed files with 41 additions and 2 deletions

View File

@ -171,8 +171,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Wed Sep 13 2023 Karolina Surma <ksurma@redhat.com> - 1.10.0-1
* Wed Sep 13 2023 Python Maint <python-maint@redhat.com> - 1.10.0-1
- Add %%_pyproject_check_import_allow_no_modules for automated environments
- Fix handling of tox 4 provision without and explicit tox minversion
- Fixes: rhbz#2240590
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

View File

@ -386,7 +386,7 @@ def generate_tox_requirements(toxenv, requirements):
provision_content = provision.read()
if provision_content and r.returncode != 0:
provision_requires = json.loads(provision_content)
if 'minversion' in provision_requires:
if provision_requires.get('minversion') is not None:
requirements.add(f'tox >= {provision_requires["minversion"]}',
source='tox provision (minversion)')
if 'requires' in provision_requires:

View File

@ -589,6 +589,43 @@ tox provision satisfied:
python3dist(inst)
result: 0
tox provision no minversion:
installed:
setuptools: 50
wheel: 1
tox: 3.5.3
tox-current-env: 0.0.6
toxenv:
- py3
setup.py: |
from setuptools import setup
setup(
name='test',
version='0.1',
)
tox.ini: |
[tox]
requires =
setuptools > 40
wheel > 2
expected:
- | # tox 3
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
- | # tox 4
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
python3dist(tox)
result: 0
Default build system, unmet deps in requirements file:
installed:
setuptools: 50