summaryrefslogtreecommitdiff
path: root/src/tox/execute
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2020-10-24 22:33:21 +0100
committerBernát Gábor <bgabor8@bloomberg.net>2020-10-25 08:45:49 +0000
commitafb3b395ddcffa6a62ddee8195b700d4d1abb47b (patch)
treea23ed28ee70f6e25626522f7159aef3de7ac9672 /src/tox/execute
parent2ad6504148550a96f1bf55887339151af9b52539 (diff)
downloadtox-git-afb3b395ddcffa6a62ddee8195b700d4d1abb47b.tar.gz
Various fixes
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/tox/execute')
-rw-r--r--src/tox/execute/api.py6
-rw-r--r--src/tox/execute/local_sub_process/__init__.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/tox/execute/api.py b/src/tox/execute/api.py
index 97e77d85..f2e9501f 100644
--- a/src/tox/execute/api.py
+++ b/src/tox/execute/api.py
@@ -131,6 +131,7 @@ class Outcome:
def assert_success(self, logger: logging.Logger) -> None:
if self.exit_code != self.OK:
self._assert_fail(logger)
+ self._log_run(logging.INFO, logger)
def _assert_fail(self, logger: logging.Logger) -> NoReturn:
if self.show_on_standard is False:
@@ -140,9 +141,12 @@ class Outcome:
print(Fore.RED, file=sys.stderr, end="")
print(self.err, file=sys.stderr, end="")
print(Fore.RESET, file=sys.stderr)
- logger.critical("exit code %d for %s: %s in %s", self.exit_code, self.request.cwd, self.shell_cmd, self.elapsed)
+ self._log_run(logging.CRITICAL, logger)
raise SystemExit(self.exit_code)
+ def _log_run(self, lvl: int, logger: logging.Logger) -> None:
+ logger.log(lvl, "exit %d (%.2fs) cwd %s: %s", self.exit_code, self.elapsed, self.request.cwd, self.shell_cmd)
+
@property
def elapsed(self) -> float:
return self.end - self.start
diff --git a/src/tox/execute/local_sub_process/__init__.py b/src/tox/execute/local_sub_process/__init__.py
index b32c1d42..be2aac39 100644
--- a/src/tox/execute/local_sub_process/__init__.py
+++ b/src/tox/execute/local_sub_process/__init__.py
@@ -89,7 +89,7 @@ class LocalSubProcessExecuteInstance(ExecuteInstance):
return exit_code
@staticmethod
- def get_stream_file_no(key: str) -> Generator[int, Popen[bytes], None]:
+ def get_stream_file_no(key: str) -> Generator[int, 'Popen[bytes]', None]:
if sys.platform != "win32" and getattr(sys, key).isatty():
# on UNIX if tty is set let's forward it via a pseudo terminal
import pty