Skip to content

Commit

Permalink
fix #1245 (#1246)
Browse files Browse the repository at this point in the history
* expose parallel show output not working

* fix #1245
  • Loading branch information
gaborbernat authored Apr 3, 2019
1 parent 8a1ab68 commit d073263
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog/1245.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:conf:`parallel_show_output` does not work with tox 3.8
7 changes: 6 additions & 1 deletion src/tox/session/commands/run/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def run_parallel(config, venv_dict):
finished = Event()

show_progress = not live_out and reporter.verbosity() > reporter.Verbosity.QUIET

with Spinner(enabled=show_progress) as spinner:

def run_in_thread(tox_env, os_env, processes):
Expand All @@ -42,13 +43,17 @@ def run_in_thread(tox_env, os_env, processes):
def collect_process(process):
processes[tox_env] = (action, process)

action.popen(
print_out = not live_out and tox_env.envconfig.parallel_show_output
output = action.popen(
args=args_sub,
env=os_env,
redirect=not live_out,
capture_err=live_out,
callback=collect_process,
returnout=print_out,
)
if print_out:
reporter.verbosity0(output)

except InvocationError as err:
status = "parallel child exit code {}".format(err.exit_code)
Expand Down
27 changes: 27 additions & 0 deletions tests/unit/session/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,30 @@ def test_parallel_recreate(cmd, initproj, monkeypatch):
end = log_dir.listdir()
assert len(end) >= 3
assert not ({f.basename for f in after} - {f.basename for f in end})


def test_parallel_show_output(cmd, initproj, monkeypatch):
monkeypatch.setenv(str("_TOX_SKIP_ENV_CREATION_TEST"), str("1"))
tox_ini = """\
[tox]
envlist = e1,e2,e3
skipsdist = true
[testenv]
whitelist_externals = {}
commands =
python -c 'import sys; sys.stderr.write("stderr env"); sys.stdout.write("stdout env")'
[testenv:e3]
commands =
python -c 'import sys; sys.stderr.write("stderr always "); sys.stdout.write("stdout always ")'
parallel_show_output = True
""".format(
sys.executable
)
initproj("pkg123-0.7", filedefs={"tox.ini": tox_ini})
result = cmd("-p", "all")
result.assert_success()
assert "stdout env" not in result.out, result.output()
assert "stderr env" not in result.out, result.output()
assert "stdout always stderr always" in result.out, result.output()

0 comments on commit d073263

Please sign in to comment.