Skip to content

Commit d073263

Browse files
authored
fix #1245 (#1246)
* expose parallel show output not working * fix #1245
1 parent 8a1ab68 commit d073263

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

docs/changelog/1245.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:conf:`parallel_show_output` does not work with tox 3.8

src/tox/session/commands/run/parallel.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def run_parallel(config, venv_dict):
2626
finished = Event()
2727

2828
show_progress = not live_out and reporter.verbosity() > reporter.Verbosity.QUIET
29+
2930
with Spinner(enabled=show_progress) as spinner:
3031

3132
def run_in_thread(tox_env, os_env, processes):
@@ -42,13 +43,17 @@ def run_in_thread(tox_env, os_env, processes):
4243
def collect_process(process):
4344
processes[tox_env] = (action, process)
4445

45-
action.popen(
46+
print_out = not live_out and tox_env.envconfig.parallel_show_output
47+
output = action.popen(
4648
args=args_sub,
4749
env=os_env,
4850
redirect=not live_out,
4951
capture_err=live_out,
5052
callback=collect_process,
53+
returnout=print_out,
5154
)
55+
if print_out:
56+
reporter.verbosity0(output)
5257

5358
except InvocationError as err:
5459
status = "parallel child exit code {}".format(err.exit_code)

tests/unit/session/test_parallel.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,30 @@ def test_parallel_recreate(cmd, initproj, monkeypatch):
158158
end = log_dir.listdir()
159159
assert len(end) >= 3
160160
assert not ({f.basename for f in after} - {f.basename for f in end})
161+
162+
163+
def test_parallel_show_output(cmd, initproj, monkeypatch):
164+
monkeypatch.setenv(str("_TOX_SKIP_ENV_CREATION_TEST"), str("1"))
165+
tox_ini = """\
166+
[tox]
167+
envlist = e1,e2,e3
168+
skipsdist = true
169+
170+
[testenv]
171+
whitelist_externals = {}
172+
commands =
173+
python -c 'import sys; sys.stderr.write("stderr env"); sys.stdout.write("stdout env")'
174+
175+
[testenv:e3]
176+
commands =
177+
python -c 'import sys; sys.stderr.write("stderr always "); sys.stdout.write("stdout always ")'
178+
parallel_show_output = True
179+
""".format(
180+
sys.executable
181+
)
182+
initproj("pkg123-0.7", filedefs={"tox.ini": tox_ini})
183+
result = cmd("-p", "all")
184+
result.assert_success()
185+
assert "stdout env" not in result.out, result.output()
186+
assert "stderr env" not in result.out, result.output()
187+
assert "stdout always stderr always" in result.out, result.output()

0 commit comments

Comments
 (0)