Skip to content

Commit

Permalink
Reset _env & _binary in App stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyifan committed Nov 2, 2023
1 parent 1fa7098 commit 6c36f14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/newsfragments/2530_changed.env_resolve_context.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:py:class:`App <testplan.testing.multitest.driver.app.App>` driver (and its inheritants) ``env`` parameter now supports jinja2 template resolving - can be used to refer to attributes of self.
6 changes: 5 additions & 1 deletion testplan/testing/multitest/driver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def binpath(self) -> str:
def binary(self) -> str:
"""The actual binary to execute, might be copied/linked to runpath"""

if self._binary and os.path.isfile(self._binary):
if self._binary:
return self._binary

if os.path.isfile(self.resolved_bin):
Expand Down Expand Up @@ -395,6 +395,10 @@ def stopping(self) -> None:
self.proc = None
if self.std:
self.std.close()

# reset env, binary etc. as they need re-eval in case of restart
self._env = None
self._binary = None
self._log_matcher = None

if (self.cfg.expected_retcode is not None) and (
Expand Down

0 comments on commit 6c36f14

Please sign in to comment.