提交 07ddb2d5 编写于 作者: L Lukáš Doktor

selftests: sysinfo collects messages if available

The sysinfo.post collects "/var/log/messages" by default. This can fail
when not running as superuser. Adjust the unittests to handle booth
variants.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 6cbd1e66
......@@ -91,8 +91,10 @@ class SysinfoTest(unittest.TestCase):
job_postdir = os.path.join(testdir, 'post')
self.assertTrue(os.path.isdir(job_postdir))
# By default, there are no post test files
self.assertEqual(len(os.listdir(job_postdir)), 0,
"Test post dir is not empty")
self.assertLess(len(os.listdir(job_postdir)), 2,
"Post dir can contain 0-1 files depending on whether "
"sys messages are obtainable or not:\n%s"
% os.listdir(job_postdir))
def tearDown(self):
shutil.rmtree(self.tmpdir)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册