mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
netcmd: tests: make check_run and related methods classmethod for consistency
Before that only run_command was turned into a @classmethod, but not the other related methods which were left unchanged, this made it inconsistent. Some of these methods need to be called from setUpTestData so they really need to be @classmethod anyway. Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
b543874abc
commit
029e0457cc
@ -475,11 +475,13 @@ class BlackboxTestCase(TestCaseInTempDir):
|
||||
|
||||
return line
|
||||
|
||||
def check_run(self, line, msg=None):
|
||||
self.check_exit_code(line, 0, msg=msg)
|
||||
@classmethod
|
||||
def check_run(cls, line, msg=None):
|
||||
cls.check_exit_code(line, 0, msg=msg)
|
||||
|
||||
def check_exit_code(self, line, expected, msg=None):
|
||||
line = self._make_cmdline(line)
|
||||
@classmethod
|
||||
def check_exit_code(cls, line, expected, msg=None):
|
||||
line = cls._make_cmdline(line)
|
||||
use_shell = not isinstance(line, list)
|
||||
p = subprocess.Popen(line,
|
||||
stdout=subprocess.PIPE,
|
||||
@ -497,9 +499,10 @@ class BlackboxTestCase(TestCaseInTempDir):
|
||||
msg)
|
||||
return stdoutdata
|
||||
|
||||
def check_output(self, line):
|
||||
@classmethod
|
||||
def check_output(cls, line):
|
||||
use_shell = not isinstance(line, list)
|
||||
line = self._make_cmdline(line)
|
||||
line = cls._make_cmdline(line)
|
||||
p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
shell=use_shell, close_fds=True)
|
||||
stdoutdata, stderrdata = p.communicate()
|
||||
|
Loading…
Reference in New Issue
Block a user