diff options
author | Michał Górny <mgorny@gentoo.org> | 2018-02-22 16:13:10 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-02-22 16:14:25 +0100 |
commit | b37b4010a5f3569e8379360662a925ba04a886bf (patch) | |
tree | 12ba1245be9b953425dce573bdf63f4f32883bec /tests | |
parent | 27bab8dd60d200e1240cc068b4239b994ffc2f49 (diff) | |
download | gemato-b37b4010a5f3569e8379360662a925ba04a886bf.tar.gz |
tests: Assert for /proc being a mountpoint for cross-fs tests
Skip cross-fs tests if /proc is not a mountpoint. This handles cases
when /proc exists but is not mounted which is quite normal
e.g. on Gentoo/FreeBSD.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_find_top_level.py | 4 | ||||
-rw-r--r-- | tests/test_recursiveloader.py | 6 | ||||
-rw-r--r-- | tests/test_verify.py | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_find_top_level.py b/tests/test_find_top_level.py index a326384..17f83c4 100644 --- a/tests/test_find_top_level.py +++ b/tests/test_find_top_level.py @@ -159,8 +159,8 @@ class TestCrossDevice(TempDirTestCase): } def setUp(self): - if not os.path.exists('/proc'): - raise unittest.SkipTest('/proc does not exist') + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') super(TestCrossDevice, self).setUp() os.symlink('/proc', os.path.join(self.dir, 'test')) diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py index 019c29f..ae757f2 100644 --- a/tests/test_recursiveloader.py +++ b/tests/test_recursiveloader.py @@ -1548,6 +1548,8 @@ DATA sub/version 0 MD5 d41d8cd98f00b204e9800998ecf8427e } def setUp(self): + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') super(CrossDeviceManifestTest, self).setUp() os.symlink('/proc', os.path.join(self.dir, 'sub')) @@ -1593,6 +1595,8 @@ class CrossDeviceEmptyManifestTest(TempDirTestCase): } def setUp(self): + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') super(CrossDeviceEmptyManifestTest, self).setUp() os.symlink('/proc', os.path.join(self.dir, 'sub')) @@ -1633,6 +1637,8 @@ IGNORE sub } def setUp(self): + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') super(CrossDeviceIgnoreManifestTest, self).setUp() os.symlink('/proc', os.path.join(self.dir, 'sub')) diff --git a/tests/test_verify.py b/tests/test_verify.py index a255068..d244c0b 100644 --- a/tests/test_verify.py +++ b/tests/test_verify.py @@ -278,6 +278,9 @@ class EmptyFileVerificationTest(unittest.TestCase): (False, [('__exists__', False, True)])) def testCrossFilesystem(self): + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') + try: st = os.stat('/proc') except OSError: @@ -352,6 +355,9 @@ class EmptyFileVerificationTest(unittest.TestCase): }) def test_update_cross_filesystem(self): + if not os.path.ismount('/proc'): + raise unittest.SkipTest('/proc is not a mountpoint') + try: st = os.stat('/proc') except OSError: |