changeset 268:4a6545360c23

Skip permissions-related unit test when running as root. Fixes #53.
author cmlenz
date Fri, 07 Oct 2005 10:43:08 +0000
parents 7429be6b5720
children 51580a463e3e
files bitten/util/tests/archive.py
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/util/tests/archive.py
+++ b/bitten/util/tests/archive.py
@@ -126,15 +126,16 @@
         repos = Mock(get_node=lambda path, rev: Mock(isdir=False))
         self.assertRaises(archive.Error, archive.pack, self.env, repos)
 
-    def test_pack_insufficient_perms(self):
-        try:
-            os.chmod(os.path.join(self.env.path, 'snapshots'), 0500)
-            repos = Mock(get_node=lambda path, rev: Mock(isdir=True))
-            self.assertRaises(archive.Error, archive.pack, self.env, repos)
-        finally:
-            # Revert permissions, otherwise the environment directory can't be
-            # deleted on windows
-            os.chmod(os.path.join(self.env.path, 'snapshots'), 0700)
+    if not hasattr(os, 'geteuid') or os.geteuid() != 0:
+        def test_pack_insufficient_perms(self):
+            try:
+                os.chmod(os.path.join(self.env.path, 'snapshots'), 0500)
+                repos = Mock(get_node=lambda path, rev: Mock(isdir=True))
+                self.assertRaises(archive.Error, archive.pack, self.env, repos)
+            finally:
+                # Revert permissions, otherwise the environment directory can't
+                # be deleted on windows
+                os.chmod(os.path.join(self.env.path, 'snapshots'), 0700)
 
     def test_pack_tarbz2_empty(self):
         root_dir = Mock(isdir=True, get_entries=lambda: [], path='', rev=123)
Copyright (C) 2012-2017 Edgewall Software