提交 3efbc8a4 编写于 作者: C Cleber Rosa

Test: protect against no filename

When there's no filename (test not backed by a file), there's no
basedir and then also no expected stdout/stderr files.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 f87c72c2
......@@ -351,7 +351,8 @@ class Test(unittest.TestCase):
shutil.copyfile(self._stderr_file, self._expected_stderr_file)
def _check_reference_stdout(self):
if os.path.isfile(self._expected_stdout_file):
if (self._expected_stdout_file is not None and
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'
......@@ -359,7 +360,8 @@ class Test(unittest.TestCase):
self.assertEqual(expected, actual, msg)
def _check_reference_stderr(self):
if os.path.isfile(self._expected_stderr_file):
if (self._expected_stderr_file is not None and
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'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册