提交 01be14dd 编写于 作者: A Amador Pahim 提交者: GitHub

Merge pull request #1284 from ldoktor/unittest-fixes

selftests: Few pre-release unittest fixes
...@@ -125,12 +125,15 @@ class ArchiveTest(unittest.TestCase): ...@@ -125,12 +125,15 @@ class ArchiveTest(unittest.TestCase):
self.assertEqual(os.path.realpath(get_path("link_to_dir")), self.assertEqual(os.path.realpath(get_path("link_to_dir")),
get_path("dir")) get_path("dir"))
# File permissions # File permissions
# TODO: Handle permission correctly for all users
# Default perm by user is 0o664 and by root 0o644
default_perm = 0o664 if os.getuid() else 0o644
self.assertEqual(os.stat(get_path("dir", "file2")).st_mode & 0o777, self.assertEqual(os.stat(get_path("dir", "file2")).st_mode & 0o777,
0o664) default_perm)
self.assertEqual(os.stat(get_path("file")).st_mode & 0o777, 0o753) self.assertEqual(os.stat(get_path("file")).st_mode & 0o777, 0o753)
self.assertEqual(os.stat(get_path("dir")).st_mode & 0o777, 0o775) self.assertEqual(os.stat(get_path("dir")).st_mode & 0o777, 0o775)
self.assertEqual(os.stat(get_path("link_to_file2")).st_mode & 0o777, self.assertEqual(os.stat(get_path("link_to_file2")).st_mode & 0o777,
0o664) default_perm)
self.assertEqual(os.stat(get_path("link_to_dir")).st_mode & 0o777, self.assertEqual(os.stat(get_path("link_to_dir")).st_mode & 0o777,
0o775) 0o775)
self.assertEqual(os.stat(get_path("link_to_file")).st_mode & 0o777, self.assertEqual(os.stat(get_path("link_to_file")).st_mode & 0o777,
......
...@@ -26,6 +26,8 @@ class TestPartition(unittest.TestCase): ...@@ -26,6 +26,8 @@ class TestPartition(unittest.TestCase):
Unit tests for avocado.utils.partition Unit tests for avocado.utils.partition
""" """
@unittest.skipIf(process.system("which mkfs", ignore_status=True),
"mkfs is required for these tests to run.")
def setUp(self): def setUp(self):
try: try:
process.system("/bin/true", sudo=True) process.system("/bin/true", sudo=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册