[PATCH 26/55] Rename TestSkipped to Skiptest, consistent with Python 2.7.

Jelmer Vernooij jelmer at samba.org
Fri Feb 6 12:03:58 MST 2015


Change-Id: I023df54363328333f1cb6c3ae3c1a406befa8f7b
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
---
 python/samba/tests/__init__.py |  4 ++--
 python/samba/tests/docs.py     |  3 +--
 python/samba/tests/ntacls.py   |  7 +++----
 python/samba/tests/xattr.py    | 10 +++++-----
 4 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py
index dc6a247..25de135 100644
--- a/python/samba/tests/__init__.py
+++ b/python/samba/tests/__init__.py
@@ -29,9 +29,9 @@ import tempfile
 import unittest
 
 try:
-    from unittest import SkipTest as TestSkipped
+    from unittest import SkipTest
 except ImportError:
-    class TestSkipped(Exception):
+    class SkipTest(Exception):
         """Test skipped."""
 
 
diff --git a/python/samba/tests/docs.py b/python/samba/tests/docs.py
index a6a1a15..d57701d 100644
--- a/python/samba/tests/docs.py
+++ b/python/samba/tests/docs.py
@@ -21,9 +21,7 @@
 
 import samba
 import samba.tests
-from samba.tests import TestSkipped, TestCaseInTempDir
 
-import errno
 import os
 import re
 import subprocess
@@ -36,6 +34,7 @@ class TestCase(samba.tests.TestCaseInTempDir):
         parameters.sort()
         return message + '\n\n    %s' % ('\n    '.join(parameters))
 
+
 def get_documented_parameters(sourcedir):
     path = os.path.join(sourcedir, "bin", "default", "docs-xml", "smbdotconf")
     if not os.path.exists(os.path.join(path, "parameters.all.xml")):
diff --git a/python/samba/tests/ntacls.py b/python/samba/tests/ntacls.py
index aa9ef68..8cd09fb 100644
--- a/python/samba/tests/ntacls.py
+++ b/python/samba/tests/ntacls.py
@@ -19,10 +19,9 @@
 """Tests for samba.ntacls."""
 
 from samba.ntacls import setntacl, getntacl, XattrBackendError
-from samba.dcerpc import xattr, security
 from samba.param import LoadParm
-from samba.tests import TestCaseInTempDir, TestSkipped
-import random
+from samba.dcerpc import security
+from samba.tests import TestCaseInTempDir, SkipTest
 import os
 
 class NtaclsTests(TestCaseInTempDir):
@@ -64,7 +63,7 @@ class NtaclsTests(TestCaseInTempDir):
 
     def test_setntacl_forcenative(self):
         if os.getuid() == 0:
-            raise TestSkipped("Running test as root, test skipped")
+            raise SkipTest("Running test as root, test skipped")
         lp = LoadParm()
         acl = "O:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)"
         open(self.tempf, 'w').write("empty")
diff --git a/python/samba/tests/xattr.py b/python/samba/tests/xattr.py
index 89add28..6387452 100644
--- a/python/samba/tests/xattr.py
+++ b/python/samba/tests/xattr.py
@@ -22,9 +22,9 @@ from samba.xattr import copytree_with_xattrs
 from samba.dcerpc import xattr
 from samba.ndr import ndr_pack
 from samba.tests import (
+    SkipTest,
     TestCase,
     TestCaseInTempDir,
-    TestSkipped,
     )
 import random
 import shutil
@@ -42,7 +42,7 @@ class XattrTests(TestCase):
 
     def test_set_xattr_native(self):
         if not samba.xattr_native.is_xattr_supported():
-            raise TestSkipped()
+            raise SkipTest()
         ntacl = xattr.NTACL()
         ntacl.version = 1
         tempf = self._tmpfilename()
@@ -51,12 +51,12 @@ class XattrTests(TestCase):
             samba.xattr_native.wrap_setxattr(tempf, "user.unittests",
                 ndr_pack(ntacl))
         except IOError:
-            raise TestSkipped("the filesystem where the tests are runned do not support XATTR")
+            raise SkipTest("the filesystem where the tests are runned do not support XATTR")
         os.unlink(tempf)
 
     def test_set_and_get_native(self):
         if not samba.xattr_native.is_xattr_supported():
-            raise TestSkipped()
+            raise SkipTest()
         tempf = self._tmpfilename()
         reftxt = "this is a test"
         open(tempf, 'w').write("empty")
@@ -65,7 +65,7 @@ class XattrTests(TestCase):
             text = samba.xattr_native.wrap_getxattr(tempf, "user.unittests")
             self.assertEquals(text, reftxt)
         except IOError:
-            raise TestSkipped("the filesystem where the tests are runned do not support XATTR")
+            raise SkipTest("the filesystem where the tests are runned do not support XATTR")
         os.unlink(tempf)
 
     def test_set_xattr_tdb(self):
-- 
2.1.4



More information about the samba-technical mailing list