When tox fails, print tox output before failing
Previously, it wasn't possible to see why tox failed: ... Requirement satisfied: tox-current-env >= 0.0.2 (installed: tox-current-env 0.0.2) Traceback (most recent call last): File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 269, in main generate_requires( File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 221, in generate_requires generate_tox_requirements(toxenv, requirements) File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 184, in generate_tox_requirements r = subprocess.run( File "/usr/lib64/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['tox', '--print-deps-to-file', '/tmp/tmp96smu4rv', '-qre', 'py38']' returned non-zero exit status 1. Now it is: ... Requirement satisfied: tox-current-env >= 0.0.2 (installed: tox-current-env 0.0.2) ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found Traceback (most recent call last): File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 270, in main generate_requires( File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 222, in generate_requires generate_tox_requirements(toxenv, requirements) File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 193, in generate_tox_requirements r.check_returncode() File "/usr/lib64/python3.8/subprocess.py", line 444, in check_returncode raise CalledProcessError(self.returncode, self.args, self.stdout, subprocess.CalledProcessError: Command '['tox', '--print-deps-to-file', '/tmp/tmpwp8sffv1', '-qre', 'py38']' returned non-zero exit status 1. Inspired by https://src.fedoraproject.org/rpms/python-chaospy/pull-request/1#comment-32750
This commit is contained in:
parent
2262ba2ff5
commit
d5c3fb3c5a
@ -6,7 +6,7 @@ License: MIT
|
|||||||
|
|
||||||
# Keep the version at zero and increment only release
|
# Keep the version at zero and increment only release
|
||||||
Version: 0
|
Version: 0
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
|
|
||||||
Source0: macros.pyproject
|
Source0: macros.pyproject
|
||||||
Source1: pyproject_buildrequires.py
|
Source1: pyproject_buildrequires.py
|
||||||
@ -87,6 +87,9 @@ install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Oct 25 2019 Miro Hrončok <mhroncok@redhat.com> - 0-8
|
||||||
|
- When tox fails, print tox output before failing
|
||||||
|
|
||||||
* Tue Oct 08 2019 Miro Hrončok <mhroncok@redhat.com> - 0-7
|
* Tue Oct 08 2019 Miro Hrončok <mhroncok@redhat.com> - 0-7
|
||||||
- Move a verbose line of %%pyproject_buildrequires from stdout to stderr
|
- Move a verbose line of %%pyproject_buildrequires from stdout to stderr
|
||||||
|
|
||||||
|
@ -183,13 +183,14 @@ def generate_tox_requirements(toxenv, requirements):
|
|||||||
with tempfile.NamedTemporaryFile('r') as depfile:
|
with tempfile.NamedTemporaryFile('r') as depfile:
|
||||||
r = subprocess.run(
|
r = subprocess.run(
|
||||||
['tox', '--print-deps-to-file', depfile.name, '-qre', toxenv],
|
['tox', '--print-deps-to-file', depfile.name, '-qre', toxenv],
|
||||||
check=True,
|
check=False,
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
)
|
)
|
||||||
if r.stdout:
|
if r.stdout:
|
||||||
print_err(r.stdout)
|
print_err(r.stdout, end='')
|
||||||
|
r.check_returncode()
|
||||||
requirements.extend(depfile.read().splitlines(),
|
requirements.extend(depfile.read().splitlines(),
|
||||||
source=f'tox --print-deps-only: {toxenv}')
|
source=f'tox --print-deps-only: {toxenv}')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user