From: Andrew Bartlett Date: Wed, 14 Jun 2023 22:49:32 +0000 (+1200) Subject: python/tests: Make helpful, stateless methods @classmethod and @staticmethod X-Git-Tag: talloc-2.4.1~409 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae7f2b417b74f12d6d5e09669b4a56b19a453015;p=thirdparty%2Fsamba.git python/tests: Make helpful, stateless methods @classmethod and @staticmethod This allows them to be used in setUpClass in tests. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 101f5922a22..f117d0b1341 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -393,7 +393,8 @@ class BlackboxProcessError(Exception): class BlackboxTestCase(TestCaseInTempDir): """Base test case for blackbox tests.""" - def _make_cmdline(self, line): + @staticmethod + def _make_cmdline(line): """Expand the called script into a fully resolved path in the bin directory.""" if isinstance(line, list): @@ -458,8 +459,9 @@ class BlackboxTestCase(TestCaseInTempDir): # where ret is the return code # stdout is a string containing the commands stdout # stderr is a string containing the commands stderr - def run_command(self, line): - line = self._make_cmdline(line) + @classmethod + def run_command(cls, line): + line = cls._make_cmdline(line) use_shell = not isinstance(line, list) p = subprocess.Popen(line, stdout=subprocess.PIPE,