]> granicus.if.org Git - python/commitdiff
remove test_support.TestSkipped and just use unittest.SkipTest
authorBenjamin Peterson <benjamin@python.org>
Thu, 26 Mar 2009 20:48:25 +0000 (20:48 +0000)
committerBenjamin Peterson <benjamin@python.org>
Thu, 26 Mar 2009 20:48:25 +0000 (20:48 +0000)
44 files changed:
Lib/test/regrtest.py
Lib/test/test__locale.py
Lib/test/test_commands.py
Lib/test/test_curses.py
Lib/test/test_decimal.py
Lib/test/test_dl.py
Lib/test/test_epoll.py
Lib/test/test_fork1.py
Lib/test/test_gl.py
Lib/test/test_ioctl.py
Lib/test/test_kqueue.py
Lib/test/test_largefile.py
Lib/test/test_linuxaudiodev.py
Lib/test/test_locale.py
Lib/test/test_macostools.py
Lib/test/test_mhlib.py
Lib/test/test_minidom.py
Lib/test/test_multiprocessing.py
Lib/test/test_nis.py
Lib/test/test_openpty.py
Lib/test/test_ossaudiodev.py
Lib/test/test_pep277.py
Lib/test/test_pipes.py
Lib/test/test_poll.py
Lib/test/test_popen2.py
Lib/test/test_posix.py
Lib/test/test_pty.py
Lib/test/test_py3kwarn.py
Lib/test/test_signal.py
Lib/test/test_site.py
Lib/test/test_socketserver.py
Lib/test/test_sqlite.py
Lib/test/test_ssl.py
Lib/test/test_sunaudiodev.py
Lib/test/test_support.py
Lib/test/test_tempfile.py
Lib/test/test_threaded_import.py
Lib/test/test_threadsignals.py
Lib/test/test_tk.py
Lib/test/test_ttk_guionly.py
Lib/test/test_unicode_file.py
Lib/test/test_univnewlines.py
Lib/test/test_wait3.py
Lib/test/test_wait4.py

index 955e551e58594c7dd94e6d34cc61f64d1a6d0e24..9f480a3d49023013c077ded4a3f216bf9d33f8e2 100755 (executable)
@@ -132,6 +132,7 @@ import sys
 import time
 import traceback
 import warnings
+import unittest
 
 # I see no other way to suppress these warnings;
 # putting them in test_grammar.py has no effect:
@@ -567,7 +568,7 @@ def runtest_inner(test, verbose, quiet, test_times,
             print test, "skipped --", msg
             sys.stdout.flush()
         return -2
-    except (ImportError, test_support.TestSkipped), msg:
+    except (ImportError, unittest.SkipTest), msg:
         if not quiet:
             print test, "skipped --", msg
             sys.stdout.flush()
index 69fc6253b4c3cafd2e1e783767af674583703eb3..35001dc45f11c818305c20dd723393c0ec57d06a 100644 (file)
@@ -1,4 +1,4 @@
-from test.test_support import verbose, TestSkipped, run_unittest
+from test.test_support import verbose, SkipTest, run_unittest
 from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo,
                     localeconv, Error)
 import unittest
@@ -7,7 +7,7 @@ from platform import uname
 if uname()[0] == "Darwin":
     maj, min, mic = [int(part) for part in uname()[2].split(".")]
     if (maj, min, mic) < (8, 0, 0):
-        raise TestSkipped("locale support broken for OS X < 10.4")
+        raise SkipTest("locale support broken for OS X < 10.4")
 
 candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT',
     'et_EE', 'es_PY', 'no_NO', 'nl_NL', 'lv_LV', 'el_GR', 'be_BY', 'fr_BE',
index d899d6699e1d36e4d2ea6d434d58ec0e17b6e443..530d9e39130202a8832750dc6fd0f2a1b6c11a23 100644 (file)
@@ -9,7 +9,7 @@ import warnings
 warnings.filterwarnings('ignore', r".*commands.getstatus.. is deprecated",
                         DeprecationWarning)
 
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import SkipTest, run_unittest, reap_children
 from commands import *
 
 # The module says:
@@ -19,7 +19,7 @@ from commands import *
 # I'll take the comment as given, and skip this suite.
 
 if os.name != 'posix':
-    raise TestSkipped('Not posix; skipping test_commands')
+    raise SkipTest('Not posix; skipping test_commands')
 
 
 class CommandTests(unittest.TestCase):
index d1b80f88dc2ceff6c4dbd542a00301982c221e16..9fe344aeccfcdb1fef090065d431fcbaad67f9bc 100644 (file)
@@ -16,16 +16,16 @@ import curses.panel
 # 'curses' resource be given on the regrtest command line using the -u
 # option.  If not available, nothing after this line will be executed.
 
-from test.test_support import requires, TestSkipped
+from test.test_support import requires, SkipTest
 requires('curses')
 
 # XXX: if newterm was supported we could use it instead of initscr and not exit
 term = os.environ.get('TERM')
 if not term or term == 'unknown':
-    raise TestSkipped, "$TERM=%r, calling initscr() may cause exit" % term
+    raise SkipTest, "$TERM=%r, calling initscr() may cause exit" % term
 
 if sys.platform == "cygwin":
-    raise TestSkipped("cygwin's curses mostly just hangs")
+    raise SkipTest("cygwin's curses mostly just hangs")
 
 def window_funcs(stdscr):
     "Test the methods of windows"
index bb5103c8a36986834b4dc9ed9b24309c3d243d32..131c893532773823509a7627424931db86834ec8 100644 (file)
@@ -31,7 +31,7 @@ import pickle, copy
 import unittest
 from decimal import *
 import numbers
-from test.test_support import (TestSkipped, run_unittest, run_doctest,
+from test.test_support import (SkipTest, run_unittest, run_doctest,
                                is_resource_enabled)
 import random
 try:
@@ -194,7 +194,7 @@ class DecimalTest(unittest.TestCase):
     def eval_file(self, file):
         global skip_expected
         if skip_expected:
-            raise TestSkipped
+            raise SkipTest
             return
         for line in open(file).xreadlines():
             line = line.replace('\r\n', '').replace('\n', '')
index c04bc1b530055276933684899bcd1a14114cb310..89f999dd3da52d44afab87059a9fe79885b5ad0a 100755 (executable)
@@ -2,7 +2,7 @@
 """Test dlmodule.c
    Roger E. Masse  revised strategy by Barry Warsaw
 """
-from test.test_support import verbose,TestSkipped, import_module
+from test.test_support import verbose,SkipTest, import_module
 dl = import_module('dl', deprecated=True)
 
 sharedlibs = [
@@ -31,7 +31,7 @@ def test_main():
                 print 'worked!'
             break
     else:
-        raise TestSkipped, 'Could not open any shared libraries'
+        raise SkipTest, 'Could not open any shared libraries'
 
 
 if __name__ == '__main__':
index ab1756cde5088e724737141657e791f2ff6c7e2f..2362ad5072fab8b011155cdddc6b9abfd1c89c16 100644 (file)
@@ -31,13 +31,13 @@ import unittest
 
 from test import test_support
 if not hasattr(select, "epoll"):
-    raise test_support.TestSkipped("test works only on Linux 2.6")
+    raise unittest.SkipTest("test works only on Linux 2.6")
 
 try:
     select.epoll()
 except IOError, e:
     if e.errno == errno.ENOSYS:
-        raise test_support.TestSkipped("kernel doesn't support epoll()")
+        raise unittest.SkipTest("kernel doesn't support epoll()")
 
 class TestEPoll(unittest.TestCase):
 
index e64e3989999db11ff170688a9cac621cdd012747..4131d372655fdf9b10c98af504f7f3dc97c4e1f5 100644 (file)
@@ -4,12 +4,12 @@
 import os
 import time
 from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import SkipTest, run_unittest, reap_children
 
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_fork1"
+    raise SkipTest, "os.fork not defined -- skipping test_fork1"
 
 class ForkTest(ForkWait):
     def wait_impl(self, cpid):
index 20fd776fd18f2e9d5b8c7de81cb95e8aef953525..ceff597f5c274c1f25d45d34e12e34824dc17363 100755 (executable)
@@ -3,7 +3,7 @@
     taken mostly from the documentation.
     Roger E. Masse
 """
-from test.test_support import verbose, TestSkipped
+from test.test_support import verbose, SkipTest
 import gl, GL, time
 
 glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask',
@@ -87,7 +87,7 @@ def test_main():
     try:
         display = os.environ['DISPLAY']
     except:
-        raise TestSkipped, "No $DISPLAY -- skipping gl test"
+        raise SkipTest, "No $DISPLAY -- skipping gl test"
 
     # touch all the attributes of gl without doing anything
     if verbose:
index d46b10d5d97d2997ab5ac00d210ad744d82747b9..cc79e1ff8d4989efa4754c1fca42f27f81fe7250 100644 (file)
@@ -1,18 +1,18 @@
 import unittest
-from test.test_support import TestSkipped, run_unittest
+from test.test_support import SkipTest, run_unittest
 import os, struct
 try:
     import fcntl, termios
 except ImportError:
-    raise TestSkipped("No fcntl or termios module")
+    raise SkipTest("No fcntl or termios module")
 if not hasattr(termios,'TIOCGPGRP'):
-    raise TestSkipped("termios module doesn't have TIOCGPGRP")
+    raise SkipTest("termios module doesn't have TIOCGPGRP")
 
 try:
     tty = open("/dev/tty", "r")
     tty.close()
 except IOError:
-    raise TestSkipped("Unable to open /dev/tty")
+    raise SkipTest("Unable to open /dev/tty")
 
 try:
     import pty
@@ -41,7 +41,7 @@ class IoctlTests(unittest.TestCase):
 
     def test_ioctl_signed_unsigned_code_param(self):
         if not pty:
-            raise TestSkipped('pty module required')
+            raise SkipTest('pty module required')
         mfd, sfd = pty.openpty()
         try:
             if termios.TIOCSWINSZ < 0:
index 05c1013008897aabc46d4b2da286c971b977ad10..6216850a9d58c2f5c84cd34188a0e07ff20a35e9 100644 (file)
@@ -10,7 +10,7 @@ import unittest
 
 from test import test_support
 if not hasattr(select, "kqueue"):
-    raise test_support.TestSkipped("test works only on BSD")
+    raise unittest.SkipTest("test works only on BSD")
 
 class TestKQueue(unittest.TestCase):
     def test_create_queue(self):
index 1da0e7d1dc450f4e09b4ffba87558a8d72708b17..783881b3484869710f0b1fd0ffd91d746120e0fc 100644 (file)
@@ -6,7 +6,7 @@ import stat
 import sys
 import unittest
 from test.test_support import run_unittest, TESTFN, verbose, requires, \
-                              TestSkipped, unlink
+                              SkipTest, unlink
 
 try:
     import signal
@@ -104,7 +104,7 @@ class TestCase(unittest.TestCase):
             # this is already decided before start running the test suite
             # but we do it anyway for extra protection
             if not hasattr(f, 'truncate'):
-                raise TestSkipped, "open().truncate() not available on this system"
+                raise SkipTest, "open().truncate() not available on this system"
             f.seek(0, 2)
             # else we've lost track of the true size
             self.assertEqual(f.tell(), size+1)
@@ -155,7 +155,7 @@ def test_main():
         except (IOError, OverflowError):
             f.close()
             unlink(TESTFN)
-            raise TestSkipped, "filesystem does not have largefile support"
+            raise SkipTest, "filesystem does not have largefile support"
         else:
             f.close()
     suite = unittest.TestSuite()
index 813df6fc73211e7933b20aa76289eecd3c237ce1..c13a02e439f2fd01d1bb3875b5c06149771f6aed 100644 (file)
@@ -1,7 +1,7 @@
 from test import test_support
 test_support.requires('audio')
 
-from test.test_support import findfile, TestSkipped, run_unittest
+from test.test_support import findfile, SkipTest, run_unittest
 
 import errno
 linuxaudiodev = test_support.import_module('linuxaudiodev', deprecated=True)
@@ -89,7 +89,7 @@ def test_main():
         dsp = linuxaudiodev.open('w')
     except linuxaudiodev.error, msg:
         if msg.args[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY):
-            raise TestSkipped(msg)
+            raise SkipTest(msg)
         raise
     dsp.close()
     run_unittest(LinuxAudioDevTests)
index 2612c79fbbc24ccf58e9dc239835b6f123faff25..84865f6e19cfcde15342e6408cdce032ce9082f5 100644 (file)
@@ -1,4 +1,4 @@
-from test.test_support import run_unittest, verbose, TestSkipped
+from test.test_support import run_unittest, verbose, SkipTest
 import unittest
 import locale
 import sys
@@ -10,7 +10,7 @@ enUS_locale = None
 def get_enUS_locale():
     global enUS_locale
     if sys.platform == 'darwin':
-        raise TestSkipped("Locale support on MacOSX is minimal")
+        raise SkipTest("Locale support on MacOSX is minimal")
     if sys.platform.startswith("win"):
         tlocs = ("En", "English")
     else:
@@ -23,7 +23,7 @@ def get_enUS_locale():
             continue
         break
     else:
-        raise TestSkipped(
+        raise SkipTest(
             "Test locale not supported (tried %s)" % (', '.join(tlocs)))
     enUS_locale = tloc
     locale.setlocale(locale.LC_NUMERIC, oldlocale)
@@ -355,10 +355,10 @@ def test_main():
         TestCNumberFormatting,
         TestFrFRNumberFormatting,
     ]
-    # TestSkipped can't be raised inside unittests, handle it manually instead
+    # SkipTest can't be raised inside unittests, handle it manually instead
     try:
         get_enUS_locale()
-    except TestSkipped as e:
+    except SkipTest as e:
         if verbose:
             print "Some tests will be disabled: %s" % e
     else:
index 5c83d28c47cc7ca36d4a9aa73e6d80527bcd34be..6110ce3dff2113d6ee30933a9e0f1e0fa0d77525 100644 (file)
@@ -93,7 +93,7 @@ class TestMacostools(unittest.TestCase):
 def test_main():
     # Skip on wide unicode
     if len(u'\0'.encode('unicode-internal')) == 4:
-        raise test_support.TestSkipped("test_macostools is broken in USC4")
+        raise unittest.SkipTest("test_macostools is broken in USC4")
     test_support.run_unittest(TestMacostools)
 
 
index 04571ea3f640dd426d1c2fa2ca5e854d57d140df..8dbe2c4f76410c7aa038265b467875bc6ecf48f9 100644 (file)
@@ -7,7 +7,7 @@
 ###      mhlib.  It should.
 
 import unittest
-from test.test_support import run_unittest, TESTFN, TestSkipped, import_module
+from test.test_support import run_unittest, TESTFN, SkipTest, import_module
 import os, StringIO
 import sys
 mhlib = import_module('mhlib', deprecated=True)
@@ -21,7 +21,7 @@ if (sys.platform.startswith("win") or sys.platform=="riscos" or
     # link counts, and that causes test_listfolders() here to get back
     # an empty list from its call of listallfolders().
     # The other tests here pass on Windows.
-    raise TestSkipped("skipped on %s -- " % sys.platform +
+    raise SkipTest("skipped on %s -- " % sys.platform +
                       "too many Unix assumptions")
 
 _mhroot = TESTFN+"_MH"
index f1f137877e696f267492cf69cb69288be340bc92..f26b83f23ae63f0f873c1f18b42d4044d010852f 100644 (file)
@@ -4,7 +4,7 @@ import os
 import sys
 import pickle
 from StringIO import StringIO
-from test.test_support import verbose, run_unittest, TestSkipped
+from test.test_support import verbose, run_unittest, SkipTest
 import unittest
 
 import xml.dom
index 33debfb3ada3c2f2a3dde8d64413a10cd80b3b47..0ec6a902e0b635f49818e9c93a16c3807c1fd3f1 100644 (file)
@@ -23,8 +23,8 @@ import logging
 try:
     import multiprocessing.synchronize
 except ImportError, e:
-    from test.test_support import TestSkipped
-    raise TestSkipped(e)
+    from test.test_support import SkipTest
+    raise SkipTest(e)
 
 import multiprocessing.dummy
 import multiprocessing.connection
@@ -1812,8 +1812,8 @@ def test_main(run=None):
         try:
             lock = multiprocessing.RLock()
         except OSError:
-            from test.test_support import TestSkipped
-            raise TestSkipped("OSError raises on RLock creation, see issue 3111!")
+            from test.test_support import SkipTest
+            raise SkipTest("OSError raises on RLock creation, see issue 3111!")
 
     if run is None:
         from test.test_support import run_unittest as run
index c958d4b23a5c3fc24a3a8d78ab9d6be959c46d78..0026953f9ed68f6aa565c7e739ea9f8b5c176382 100644 (file)
@@ -10,7 +10,7 @@ class NisTests(unittest.TestCase):
             # NIS is probably not active, so this test isn't useful
             if test_support.verbose:
                 print "Test Skipped:", msg
-            # Can't raise TestSkipped as regrtest only recognizes the exception
+            # Can't raise SkipTest as regrtest only recognizes the exception
             #   import time.
             return
         try:
index 6471f58ce514b6b501bab8e72eac40e4dcdc4633..d128f61eb7764f4751b59987305ac9dc766bf925 100644 (file)
@@ -1,10 +1,10 @@
 # Test to see if openpty works. (But don't worry if it isn't available.)
 
 import os, unittest
-from test.test_support import run_unittest, TestSkipped
+from test.test_support import run_unittest, SkipTest
 
 if not hasattr(os, "openpty"):
-    raise TestSkipped, "No openpty() available."
+    raise SkipTest, "No openpty() available."
 
 
 class OpenptyTest(unittest.TestCase):
index 2a1eba7e53afd79df4041b16652ba7193edb1082..cc147b6b1e003d9a388d509b1f541dd1c0334c2c 100644 (file)
@@ -1,7 +1,7 @@
 from test import test_support
 test_support.requires('audio')
 
-from test.test_support import findfile, TestSkipped
+from test.test_support import findfile, SkipTest
 
 import errno
 import ossaudiodev
@@ -45,7 +45,7 @@ class OSSAudioDevTests(unittest.TestCase):
             dsp = ossaudiodev.open('w')
         except IOError, msg:
             if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY):
-                raise TestSkipped(msg)
+                raise SkipTest(msg)
             raise
 
         # at least check that these methods can be invoked
@@ -162,7 +162,7 @@ def test_main():
         dsp = ossaudiodev.open('w')
     except (ossaudiodev.error, IOError), msg:
         if msg[0] in (errno.EACCES, errno.ENOENT, errno.ENODEV, errno.EBUSY):
-            raise TestSkipped(msg)
+            raise SkipTest(msg)
         raise
     dsp.close()
     test_support.run_unittest(__name__)
index cb6210b02c70cda46cd8f746289db2a972e0082e..a61bcdfeaabe08b5ad4685da5b3566563fbca71e 100644 (file)
@@ -3,7 +3,7 @@
 import sys, os, unittest
 from test import test_support
 if not os.path.supports_unicode_filenames:
-    raise test_support.TestSkipped, "test works only on NT+"
+    raise unittest.SkipTest, "test works only on NT+"
 
 filenames = [
     'abc',
index 0eca8edf102e9a8bdda84b65cfc471e16b4bdf1d..45c9faf0ec87e1e6ec8c02cf0962f92966b00511 100644 (file)
@@ -2,10 +2,10 @@ import pipes
 import os
 import string
 import unittest
-from test.test_support import TESTFN, run_unittest, unlink, TestSkipped
+from test.test_support import TESTFN, run_unittest, unlink, SkipTest
 
 if os.name != 'posix':
-    raise TestSkipped('pipes module only works on posix')
+    raise SkipTest('pipes module only works on posix')
 
 TESTFN2 = TESTFN + "2"
 
index fb6cd30a0485c2bdee6c63f912cf9e8e4b33ee9d..5d01251e9aa0268e69234cd693a29b0dcd56abcc 100644 (file)
@@ -1,12 +1,12 @@
 # Test case for the os.poll() function
 
 import os, select, random, unittest
-from test.test_support import TestSkipped, TESTFN, run_unittest
+from test.test_support import SkipTest, TESTFN, run_unittest
 
 try:
     select.poll
 except AttributeError:
-    raise TestSkipped, "select.poll not defined -- skipping test_poll"
+    raise SkipTest, "select.poll not defined -- skipping test_poll"
 
 
 def find_ready_matching(ready, flag):
index 023871f598b2bca69e3fce6b2037a44e950265e8..0e0c0f4631605a77b75a37c465092aef07de0c12 100644 (file)
@@ -12,13 +12,13 @@ import sys
 import unittest
 import popen2
 
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import SkipTest, run_unittest, reap_children
 
 if sys.platform[:4] == 'beos' or sys.platform[:6] == 'atheos':
     #  Locks get messed up or something.  Generally we're supposed
     #  to avoid mixing "posix" fork & exec with native threads, and
     #  they may be right about that after all.
-    raise TestSkipped("popen2() doesn't work on " + sys.platform)
+    raise SkipTest("popen2() doesn't work on " + sys.platform)
 
 # if we don't have os.popen, check that
 # we have os.fork.  if not, skip the test
index 5f40060a6b521603073f460cb4ac4b0c5b550c17..864f96373ad8ed0c6a293dcaf8c96952461de73a 100644 (file)
@@ -5,7 +5,7 @@ from test import test_support
 try:
     import posix
 except ImportError:
-    raise test_support.TestSkipped, "posix is not available"
+    raise unittest.SkipTest, "posix is not available"
 
 import time
 import os
@@ -242,10 +242,10 @@ class PosixTester(unittest.TestCase):
                 os.mkdir(base_path)
                 os.chdir(base_path)
             except:
-#               Just returning nothing instead of the TestSkipped exception,
+#               Just returning nothing instead of the SkipTest exception,
 #               because the test results in Error in that case.
 #               Is that ok?
-#                raise test_support.TestSkipped, "cannot create directory for testing"
+#                raise unittest.SkipTest, "cannot create directory for testing"
                 return
 
             try:
@@ -253,7 +253,7 @@ class PosixTester(unittest.TestCase):
                     try:
                         os.mkdir(dirname)
                     except:
-                        raise test_support.TestSkipped, "mkdir cannot create directory sufficiently deep for getcwd test"
+                        raise unittest.SkipTest, "mkdir cannot create directory sufficiently deep for getcwd test"
 
                     os.chdir(dirname)
                     try:
index c00244f10df67ef6a91061fbc8f799c5037855c7..25a04fc2b9e268f4ba714f348886aea7f1b57c02 100644 (file)
@@ -4,7 +4,7 @@ import pty
 import os
 import sys
 import signal
-from test.test_support import verbose, TestSkipped, run_unittest
+from test.test_support import verbose, SkipTest, run_unittest
 import unittest
 
 TEST_STRING_1 = "I wish to buy a fish license.\n"
@@ -69,7 +69,7 @@ class PtyTest(unittest.TestCase):
             debug("Got slave_fd '%d'" % slave_fd)
         except OSError:
             # " An optional feature could not be imported " ... ?
-            raise TestSkipped, "Pseudo-terminals (seemingly) not functional."
+            raise SkipTest, "Pseudo-terminals (seemingly) not functional."
 
         self.assertTrue(os.isatty(slave_fd), 'slave_fd is not a tty')
 
index 1e368d5a6b2842b65efe661ac61d3d60e164000c..c4f7b1eddc03f8e776b10c7d80805527e2e7e9d6 100644 (file)
@@ -1,13 +1,13 @@
 import unittest
 import sys
 from test.test_support import (check_warnings, CleanImport,
-                               TestSkipped, run_unittest)
+                               SkipTest, run_unittest)
 import warnings
 
 from contextlib import nested
 
 if not sys.py3kwarning:
-    raise TestSkipped('%s must be run with the -3 flag' % __name__)
+    raise SkipTest('%s must be run with the -3 flag' % __name__)
 
 def reset_module_registry(module):
     try:
index 64c9cdaa01e874546523bd494fa8a8c5b2724ca3..ff5c173ea99bd5c1f7097b3dda015ff7a20b11a9 100644 (file)
@@ -10,7 +10,7 @@ import traceback
 import sys, os, time, errno
 
 if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos':
-    raise test_support.TestSkipped("Can't test signal on %s" % \
+    raise unittest.SkipTest("Can't test signal on %s" % \
                                    sys.platform)
 
 
index 2dfddcd900221a6c3eb12111796035b30a5403e5..d44f5b7b525e9bed635099cb063046fac256a071 100644 (file)
@@ -5,7 +5,7 @@ executing have not been removed.
 
 """
 import unittest
-from test.test_support import TestSkipped, run_unittest, TESTFN
+from test.test_support import SkipTest, run_unittest, TESTFN
 import __builtin__
 import os
 import sys
@@ -17,7 +17,7 @@ import subprocess
 if "site" in sys.modules:
     import site
 else:
-    raise TestSkipped("importation of site.py suppressed")
+    raise SkipTest("importation of site.py suppressed")
 
 if not os.path.isdir(site.USER_SITE):
     # need to add user site directory for tests
index b8f664fd67f0399ce2555c89c01bdd81d1dc654b..b0e3ef1e931790c94d1057aa85883418ba500f02 100644 (file)
@@ -16,7 +16,7 @@ import unittest
 import SocketServer
 
 import test.test_support
-from test.test_support import reap_children, verbose, TestSkipped
+from test.test_support import reap_children, verbose, SkipTest
 from test.test_support import TESTFN as TEST_FILE
 
 test.test_support.requires("network")
@@ -247,7 +247,7 @@ class SocketServerTest(unittest.TestCase):
 def test_main():
     if imp.lock_held():
         # If the import lock is held, the threads will hang
-        raise TestSkipped("can't run when import lock is held")
+        raise SkipTest("can't run when import lock is held")
 
     test.test_support.run_unittest(SocketServerTest)
 
index d63bb1d0f8483d95a5459bc4461c4a6afd4c8b7c..7eb0f87a9c48418b2a3713178e8cdd41fec40406 100644 (file)
@@ -1,9 +1,9 @@
-from test.test_support import run_unittest, TestSkipped
+from test.test_support import run_unittest, SkipTest
 
 try:
     import _sqlite3
 except ImportError:
-    raise TestSkipped('no sqlite available')
+    raise SkipTest('no sqlite available')
 from sqlite3.test import (dbapi, types, userfunctions, py25tests,
                                 factory, transactions, hooks, regression,
                                 dump)
index 5cfe7f14dbc6937ec448fb492ab71941144b246c..247ffcd085a0ca52804502e09686f30dae2e5435 100644 (file)
@@ -1167,7 +1167,7 @@ else:
 
 def test_main(verbose=False):
     if skip_expected:
-        raise test_support.TestSkipped("No SSL support")
+        raise unittest.SkipTest("No SSL support")
 
     global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT
     CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
index 2c5e7d4a6e0e0efd99a539e114dcbb37ed1addd3..e4f8fcbaf8794f2945571741c87f3352c2e62c1e 100644 (file)
@@ -1,4 +1,4 @@
-from test.test_support import findfile, TestFailed, TestSkipped, import_module
+from test.test_support import findfile, TestFailed, SkipTest, import_module
 sunaudiodev = import_module('sunaudiodev', deprecated=True)
 import os
 
@@ -8,7 +8,7 @@ except KeyError:
     audiodev = "/dev/audio"
 
 if not os.path.exists(audiodev):
-    raise TestSkipped("no audio device found!")
+    raise SkipTest("no audio device found!")
 
 def play_sound_file(path):
     fp = open(path, 'r')
index 9398465353ff389d77821b3c8d9457ae9fee8587..0e289c1cecfab62406d588f7fe35a41f273e9254 100644 (file)
@@ -13,7 +13,7 @@ import shutil
 import warnings
 import unittest
 
-__all__ = ["Error", "TestFailed", "TestSkipped", "ResourceDenied", "import_module",
+__all__ = ["Error", "TestFailed", "ResourceDenied", "import_module",
            "verbose", "use_resources", "max_memuse", "record_original_stdout",
            "get_original_stdout", "unload", "unlink", "rmtree", "forget",
            "is_resource_enabled", "requires", "find_unused_port", "bind_port",
@@ -33,17 +33,7 @@ class Error(Exception):
 class TestFailed(Error):
     """Test failed."""
 
-class TestSkipped(Error):
-    """Test skipped.
-
-    This can be raised to indicate that a test was deliberatly
-    skipped, but not because a feature wasn't available.  For
-    example, if some resource can't be used, such as the network
-    appears to be unavailable, this should be raised instead of
-    TestFailed.
-    """
-
-class ResourceDenied(TestSkipped):
+class ResourceDenied(SkipTest):
     """Test skipped because it requested a disallowed resource.
 
     This is raised when a test calls requires() for a resource that
@@ -52,7 +42,7 @@ class ResourceDenied(TestSkipped):
     """
 
 def import_module(name, deprecated=False):
-    """Import the module to be tested, raising TestSkipped if it is not
+    """Import the module to be tested, raising SkipTest if it is not
     available."""
     with warnings.catch_warnings():
         if deprecated:
@@ -61,7 +51,7 @@ def import_module(name, deprecated=False):
         try:
             module = __import__(name, level=0)
         except ImportError:
-            raise TestSkipped("No module named " + name)
+            raise SkipTest("No module named " + name)
         else:
             return module
 
index 74e55d80f5300a1504fda2b4c8a407df67dde579..792ad5d7b1b162a38db6b6615a79f6ba7ae3ebb9 100644 (file)
@@ -259,7 +259,7 @@ class test__mkstemp_inner(TC):
     def test_file_mode(self):
         # _mkstemp_inner creates files with the proper mode
         if not has_stat:
-            return            # ugh, can't use TestSkipped.
+            return            # ugh, can't use SkipTest.
 
         file = self.do_create()
         mode = stat.S_IMODE(os.stat(file.name).st_mode)
@@ -274,7 +274,7 @@ class test__mkstemp_inner(TC):
     def test_noinherit(self):
         # _mkstemp_inner file handles are not inherited by child processes
         if not has_spawnl:
-            return            # ugh, can't use TestSkipped.
+            return            # ugh, can't use SkipTest.
 
         if test_support.verbose:
             v="v"
@@ -312,7 +312,7 @@ class test__mkstemp_inner(TC):
     def test_textmode(self):
         # _mkstemp_inner can create files in text mode
         if not has_textmode:
-            return            # ugh, can't use TestSkipped.
+            return            # ugh, can't use SkipTest.
 
         self.do_create(bin=0).write("blat\n")
         # XXX should test that the file really is a text file
@@ -476,7 +476,7 @@ class test_mkdtemp(TC):
     def test_mode(self):
         # mkdtemp creates directories with the proper mode
         if not has_stat:
-            return            # ugh, can't use TestSkipped.
+            return            # ugh, can't use SkipTest.
 
         dir = self.do_create()
         try:
index 602ad2af90146ce76fbb7ce38abd357999e4cac4..dc88a8b3cdd85892a6c2d3596c5a61497c619bcc 100644 (file)
@@ -6,7 +6,7 @@
 # randrange, and then Python hangs.
 
 import thread
-from test.test_support import verbose, TestSkipped, TestFailed
+from test.test_support import verbose, SkipTest, TestFailed
 
 critical_section = thread.allocate_lock()
 done = thread.allocate_lock()
@@ -56,7 +56,7 @@ def test_main():        # magic name!  see above
     import imp
     if imp.lock_held():
         # This triggers on, e.g., from test import autotest.
-        raise TestSkipped("can't run when import lock is held")
+        raise SkipTest("can't run when import lock is held")
 
     done.acquire()
     for N in (20, 50) * 3:
index 1f10fe722f5181b03778edd3443c5f5acf083ae2..b2847d863beb8be90836fa4901e4db6acc3893d0 100644 (file)
@@ -5,10 +5,10 @@ import thread
 import signal
 import os
 import sys
-from test.test_support import run_unittest, TestSkipped
+from test.test_support import run_unittest, SkipTest
 
 if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos':
-    raise TestSkipped, "Can't test signal on %s" % sys.platform
+    raise SkipTest, "Can't test signal on %s" % sys.platform
 
 process_pid = os.getpid()
 signalled_all=thread.allocate_lock()
index e1f9c5bfe216305047d08f7287fb25d529569c77..dedda0df88d3f46cf061b75041319eb9a40f8ea7 100644 (file)
@@ -7,7 +7,7 @@ try:
     Tkinter.Button()
 except Tkinter.TclError, msg:
     # assuming tk is not available
-    raise test_support.TestSkipped("tk not available: %s" % msg)
+    raise unittest.SkipTest("tk not available: %s" % msg)
 
 this_dir = os.path.dirname(os.path.abspath(__file__))
 lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
index 6691b88db06ac0455c1c4e2981c90819fda61223..a800d62eda962b31fbd582e221cbd18c27a9b752 100644 (file)
@@ -8,7 +8,7 @@ try:
     ttk.Button()
 except TclError, msg:
     # assuming ttk is not available
-    raise test_support.TestSkipped("ttk not available: %s" % msg)
+    raise unittest.SkipTest("ttk not available: %s" % msg)
 
 this_dir = os.path.dirname(os.path.abspath(__file__))
 lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
index 305f98b79a6be836341681c9c652cef81309f352..d9a810da596196b790cd0d4e429d1dbc2a482e66 100644 (file)
@@ -5,14 +5,14 @@ import os, glob, time, shutil
 import unicodedata
 
 import unittest
-from test.test_support import run_unittest, TestSkipped, TESTFN_UNICODE
+from test.test_support import run_unittest, SkipTest, TESTFN_UNICODE
 from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE
 try:
     TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING)
 except (UnicodeError, TypeError):
     # Either the file system encoding is None, or the file name
     # cannot be encoded in the file system encoding.
-    raise TestSkipped("No Unicode filesystem semantics on this platform.")
+    raise SkipTest("No Unicode filesystem semantics on this platform.")
 
 if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE:
     # The file system encoding does not support Latin-1
@@ -26,10 +26,10 @@ if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE:
             # MBCS will not report the error properly
             raise UnicodeError, "mbcs encoding problem"
     except (UnicodeError, TypeError):
-        raise TestSkipped("Cannot find a suiteable filename.")
+        raise SkipTest("Cannot find a suiteable filename.")
 
 if TESTFN_ENCODED.decode(TESTFN_ENCODING) != TESTFN_UNICODE:
-    raise TestSkipped("Cannot find a suitable filename.")
+    raise SkipTest("Cannot find a suitable filename.")
 
 def remove_if_exists(filename):
     if os.path.exists(filename):
index d6bd64655d927148a83a577ad2a885901610dc71..370a4b77f4ac90868671b9e3c5b2a25f13df2c20 100644 (file)
@@ -5,7 +5,7 @@ import sys
 from test import test_support
 
 if not hasattr(sys.stdin, 'newlines'):
-    raise test_support.TestSkipped, \
+    raise unittest.SkipTest, \
         "This Python does not have universal newline support"
 
 FATX = 'x' * (2**14)
index 9de64b21ea328eb34c1daf754c3dac0b27f852ab..474a15b9dbfc941c89e7194d2d9ae0db786a89f6 100644 (file)
@@ -4,17 +4,17 @@
 import os
 import time
 from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import SkipTest, run_unittest, reap_children
 
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_wait3"
+    raise SkipTest, "os.fork not defined -- skipping test_wait3"
 
 try:
     os.wait3
 except AttributeError:
-    raise TestSkipped, "os.wait3 not defined -- skipping test_wait3"
+    raise SkipTest, "os.wait3 not defined -- skipping test_wait3"
 
 class Wait3Test(ForkWait):
     def wait_impl(self, cpid):
index 9f7fc14a64af3cb95315874ea58d2499dde3b23a..9a94d7bc31c120b56a2e956d84fea149d5f7f704 100644 (file)
@@ -4,17 +4,17 @@
 import os
 import time
 from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest, reap_children
+from test.test_support import SkipTest, run_unittest, reap_children
 
 try:
     os.fork
 except AttributeError:
-    raise TestSkipped, "os.fork not defined -- skipping test_wait4"
+    raise SkipTest, "os.fork not defined -- skipping test_wait4"
 
 try:
     os.wait4
 except AttributeError:
-    raise TestSkipped, "os.wait4 not defined -- skipping test_wait4"
+    raise SkipTest, "os.wait4 not defined -- skipping test_wait4"
 
 class Wait4Test(ForkWait):
     def wait_impl(self, cpid):