提交 2852f2b2 编写于 作者: C Cleber Rosa

Test: allow datadir to be optional

Some Test types are not backed directly by files, and thus do
not have a datadir. One example is Avocado-VT's VirtTest class.
Because of that, and because other custom Test types may adhere
to the same logic of not having a datadir, let's make Avocado's
base test class more robust against a `None` datadir.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 14dda8e8
......@@ -90,10 +90,15 @@ 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,
'stdout.expected')
self._expected_stderr_file = os.path.join(self.datadir,
'stderr.expected')
if self.datadir is None:
self._expected_stdout_file = None
self._expected_stderr_file = None
else:
self._expected_stdout_file = os.path.join(self.datadir,
'stdout.expected')
self._expected_stderr_file = os.path.join(self.datadir,
'stderr.expected')
if base_logdir is None:
base_logdir = data_dir.create_job_logs_dir()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册