提交 976620b3 编写于 作者: C Cleber Rosa

sysinfo: unittest adjustments

As the sysinfo configuration moves from hard coded to configurable,
unittests should not count on any existing condition, such as the
existence of files or commands collected.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 0a6dc703
......@@ -40,8 +40,8 @@ class SysInfoTest(unittest.TestCase):
self.assertGreater(len(os.listdir(sysinfo_dir)), 0, msg)
for hook in ('pre', 'post'):
sysinfo_subdir = os.path.join(sysinfo_dir, hook)
msg = 'The sysinfo/%s subdirectory is empty:\n%s' % (hook, result)
self.assertGreater(len(os.listdir(sysinfo_subdir)), 0, msg)
msg = 'The sysinfo/%s subdirectory does not exist:\n%s' % (hook, result)
self.assertTrue(os.path.exists(sysinfo_subdir), msg)
def test_sysinfo_disabled(self):
os.chdir(basedir)
......
......@@ -69,13 +69,9 @@ class SysinfoTest(unittest.TestCase):
"Job does not have 'pre' dir")
job_predir = os.path.join(jobdir, 'pre')
self.assertTrue(os.path.isdir(job_predir))
self.assertGreater(len(os.listdir(job_predir)), 0,
"Job pre dir is empty")
sysinfo_logger.end_job_hook()
job_postdir = os.path.join(jobdir, 'post')
self.assertTrue(os.path.isdir(job_postdir))
self.assertGreater(len(os.listdir(job_postdir)), 0,
"Job post dir is empty")
def test_logger_test_hooks(self):
testdir = os.path.join(self.tmpdir, 'job', 'test1')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册