From 6c36f14e15c1f18faa0f6b6d4d7a46c50addb3a0 Mon Sep 17 00:00:00 2001 From: Pyifan Date: Thu, 2 Nov 2023 10:00:33 +0800 Subject: [PATCH] Reset _env & _binary in App stopping --- doc/newsfragments/2530_changed.env_resolve_context.rst | 1 + testplan/testing/multitest/driver/app.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 doc/newsfragments/2530_changed.env_resolve_context.rst diff --git a/doc/newsfragments/2530_changed.env_resolve_context.rst b/doc/newsfragments/2530_changed.env_resolve_context.rst new file mode 100644 index 000000000..96ae08b81 --- /dev/null +++ b/doc/newsfragments/2530_changed.env_resolve_context.rst @@ -0,0 +1 @@ +:py:class:`App ` driver (and its inheritants) ``env`` parameter now supports jinja2 template resolving - can be used to refer to attributes of self. diff --git a/testplan/testing/multitest/driver/app.py b/testplan/testing/multitest/driver/app.py index 182405331..904576b02 100644 --- a/testplan/testing/multitest/driver/app.py +++ b/testplan/testing/multitest/driver/app.py @@ -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): @@ -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 (