From 99af507926d92e1da25806125a5825374ecaf069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 21 Feb 2017 13:47:10 +0100 Subject: [PATCH] Test: Turn `params` into a property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change should decrease the probability of users accidentally overriding `Test.params` while keeping the usage the same. There is one caveat and that is Avocado-vt, which modifies `self.params`, which is not that simple anymore. I have a fix for it, but the problem is it is not backward compatible and it can only be changed to forward-compatible. We should consider whether the benefit of having this "a bit" protected is greater than backward incompatible change with Avocado-vt (and possibly other "nasty" user's tests) Signed-off-by: Lukáš Doktor --- avocado/core/test.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/avocado/core/test.py b/avocado/core/test.py index 48807af4..301fe6f8 100644 --- a/avocado/core/test.py +++ b/avocado/core/test.py @@ -225,9 +225,9 @@ class Test(unittest.TestCase): params = [] elif isinstance(params, tuple): params, mux_path = params[0], params[1] - self.params = varianter.AvocadoParams(params, self.name, - mux_path, - self.default_params) + self.__params = varianter.AvocadoParams(params, self.name, + mux_path, + self.default_params) default_timeout = getattr(self, "timeout", None) self.timeout = self.params.get("timeout", default=default_timeout) @@ -288,6 +288,13 @@ class Test(unittest.TestCase): """ return self.__outputdir + @property + def params(self): + """ + Parameters of this test (AvocadoParam instance) + """ + return self.__params + @property def basedir(self): """ -- GitLab