1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

python/tests: Make helpful, stateless methods @classmethod and @staticmethod

This allows them to be used in setUpClass in tests.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2023-06-15 10:49:32 +12:00
parent b8a613b4b1
commit ae7f2b417b

View File

@ -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,