提交 14dda8e8 编写于 作者: C Cleber Rosa

Test: hide expected stdout/stderr attributes

Now that 7c967bb0 hid the methods that record/check stdout/stderr,
let's also hide the attributes that hold their paths.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 b848aa83
......@@ -90,9 +90,9 @@ class Test(unittest.TestCase):
self.filename = inspect.getfile(self.__class__).rstrip('co')
self.basedir = os.path.dirname(self.filename)
self.expected_stdout_file = os.path.join(self.datadir,
self._expected_stdout_file = os.path.join(self.datadir,
'stdout.expected')
self.expected_stderr_file = os.path.join(self.datadir,
self._expected_stderr_file = os.path.join(self.datadir,
'stderr.expected')
if base_logdir is None:
......@@ -323,23 +323,23 @@ class Test(unittest.TestCase):
def _record_reference_stdout(self):
utils_path.init_dir(self.datadir)
shutil.copyfile(self.stdout_file, self.expected_stdout_file)
shutil.copyfile(self.stdout_file, self._expected_stdout_file)
def _record_reference_stderr(self):
utils_path.init_dir(self.datadir)
shutil.copyfile(self.stderr_file, self.expected_stderr_file)
shutil.copyfile(self.stderr_file, self._expected_stderr_file)
def _check_reference_stdout(self):
if os.path.isfile(self.expected_stdout_file):
expected = genio.read_file(self.expected_stdout_file)
if os.path.isfile(self._expected_stdout_file):
expected = genio.read_file(self._expected_stdout_file)
actual = genio.read_file(self.stdout_file)
msg = ('Actual test sdtout differs from expected one:\n'
'Actual:\n%s\nExpected:\n%s' % (actual, expected))
self.assertEqual(expected, actual, msg)
def _check_reference_stderr(self):
if os.path.isfile(self.expected_stderr_file):
expected = genio.read_file(self.expected_stderr_file)
if os.path.isfile(self._expected_stderr_file):
expected = genio.read_file(self._expected_stderr_file)
actual = genio.read_file(self.stderr_file)
msg = ('Actual test sdterr differs from expected one:\n'
'Actual:\n%s\nExpected:\n%s' % (actual, expected))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册