Skip to content

Commit b5105b1

Browse files
committed
do not return the action identifier from the log
1 parent 6358ebd commit b5105b1

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

docs/changelog/1222.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Changes to the plugin tester module (cmd no longer sets ``PYTHONPATH``), and ``action.popen`` no longer returns the
2+
command identifier information from within the logs. No public facing changes.

src/tox/action.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ def popen(
104104
exit_code = process.returncode
105105
finally:
106106
if out_path is not None and out_path.exists():
107-
output = out_path.read()
107+
lines = out_path.read().split("\n")
108+
# first three lines are the action, cwd, and cmd - remove it
109+
output = "\n".join(lines[3:])
108110
try:
109111
if exit_code and not ignore_ret:
110112
if report_fail:
@@ -210,11 +212,13 @@ def _get_standard_streams(self, capture_err, cmd_args_shell, redirect, returnout
210212
if self.generate_tox_log or redirect:
211213
out_path = self.get_log_path(self.name)
212214
with out_path.open("wt") as stdout, out_path.open("rb") as input_file_handler:
213-
stdout.write(
214-
"action: {}, msg: {}\ncwd: {}\ncmd: {}\n".format(
215-
self.name, self.msg, cwd, cmd_args_shell
216-
)
215+
msg = "action: {}, msg: {}\ncwd: {}\ncmd: {}\n".format(
216+
self.name.replace("\n", " "),
217+
self.msg.replace("\n", " "),
218+
str(cwd).replace("\n", " "),
219+
cmd_args_shell.replace("\n", " "),
217220
)
221+
stdout.write(msg)
218222
stdout.flush()
219223
input_file_handler.read() # read the header, so it won't be written to stdout
220224
yield input_file_handler, out_path, stderr, stdout

src/tox/venv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def tox_runtest_post(venv):
737737
def tox_runenvreport(venv, action):
738738
# write out version dependency information
739739
args = venv.envconfig.list_dependencies_command
740-
output = venv._pcall(args, cwd=venv.envconfig.config.toxinidir, action=action)
740+
output = venv._pcall(args, cwd=venv.envconfig.config.toxinidir, action=action, returnout=True)
741741
# the output contains a mime-header, skip it
742742
output = output.split("\n\n")[-1]
743743
packages = output.strip().split("\n")

tests/unit/test_z_cmdline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ def test_result_json(cmd, initproj, example123):
467467
deps = setuptools
468468
commands_pre = python -c 'print("START")'
469469
commands = python -c 'print("OK")'
470-
- python -c 'raise SystemExit(1)'
471-
python -c 'raise SystemExit(2)'
470+
- python -c 'print("1"); raise SystemExit(1)'
471+
python -c 'print("1"); raise SystemExit(2)'
472472
python -c 'print("SHOULD NOT HAPPEN")'
473473
commands_post = python -c 'print("END")'
474474
"""
@@ -730,6 +730,7 @@ def test_empty_activity_shown_verbose(initproj, cmd):
730730
[testenv]
731731
list_dependencies_command=echo
732732
commands={envpython} --version
733+
whitelist_externals = echo
733734
"""
734735
},
735736
)

0 commit comments

Comments
 (0)