diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2021-09-11 21:17:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-11 21:17:08 +0100 |
| commit | 9d1a46a624862347959c22bab7e0c35dcf37187a (patch) | |
| tree | 4e3773788aea04165b11664fcd73261ecf28c3d8 /src/tox/session/cmd | |
| parent | 48da3664ecfee2173838f6604e73f48d579e56ce (diff) | |
| download | tox-git-9d1a46a624862347959c22bab7e0c35dcf37187a.tar.gz | |
Support for plugin before and after, fix ASCII report fails (#2214)
Diffstat (limited to 'src/tox/session/cmd')
| -rw-r--r-- | src/tox/session/cmd/run/single.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/tox/session/cmd/run/single.py b/src/tox/session/cmd/run/single.py index aa2a2c05..c16236a7 100644 --- a/src/tox/session/cmd/run/single.py +++ b/src/tox/session/cmd/run/single.py @@ -63,19 +63,26 @@ def _evaluate(tox_env: RunToxEnv, no_test: bool) -> Tuple[bool, int, List[Outcom def run_commands(tox_env: RunToxEnv, no_test: bool) -> Tuple[int, List[Outcome]]: outcomes: List[Outcome] = [] if no_test: - status_pre, status_main, status_post = Outcome.OK, Outcome.OK, Outcome.OK + exit_code = Outcome.OK else: + from tox.plugin.manager import MANAGER # importing this here to avoid circular import + chdir: Path = tox_env.conf["change_dir"] ignore_errors: bool = tox_env.conf["ignore_errors"] + MANAGER.tox_before_run_commands(tox_env) + status_pre, status_main, status_post = -1, -1, -1 try: - status_pre = run_command_set(tox_env, "commands_pre", chdir, ignore_errors, outcomes) - if status_pre == Outcome.OK or ignore_errors: - status_main = run_command_set(tox_env, "commands", chdir, ignore_errors, outcomes) - else: - status_main = Outcome.OK + try: + status_pre = run_command_set(tox_env, "commands_pre", chdir, ignore_errors, outcomes) + if status_pre == Outcome.OK or ignore_errors: + status_main = run_command_set(tox_env, "commands", chdir, ignore_errors, outcomes) + else: + status_main = Outcome.OK + finally: + status_post = run_command_set(tox_env, "commands_post", chdir, ignore_errors, outcomes) finally: - status_post = run_command_set(tox_env, "commands_post", chdir, ignore_errors, outcomes) - exit_code = status_pre or status_main or status_post # first non-success + exit_code = status_pre or status_main or status_post # first non-success + MANAGER.tox_after_run_commands(tox_env, exit_code, outcomes) return exit_code, outcomes |
