summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-04 13:34:43 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-04 13:34:43 (GMT)
commitb9fa0a843e239bcdaecbe16aaa508e9e25b5afce (patch)
treebc3650354409d9aca1dc994ebc293c2a3c99a498 /Lib/test
parent040c17fe38f17575d57ef2aecd6d9955d24cb0c6 (diff)
downloadcpython-b9fa0a843e239bcdaecbe16aaa508e9e25b5afce.zip
cpython-b9fa0a843e239bcdaecbe16aaa508e9e25b5afce.tar.gz
cpython-b9fa0a843e239bcdaecbe16aaa508e9e25b5afce.tar.bz2
Raise 'TestSkipped' (from the test_support) module rather than 'ImportError'
to signify a test that should be marked as 'skipped' rather than 'failed'. Also 'document' it, in README.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/README3
-rwxr-xr-xLib/test/test_binhex.py4
-rwxr-xr-xLib/test/test_dl.py4
-rw-r--r--Lib/test/test_fork1.py3
-rwxr-xr-xLib/test/test_gl.py5
-rw-r--r--Lib/test/test_nis.py4
-rw-r--r--Lib/test/test_openpty.py4
-rw-r--r--Lib/test/test_pty.py4
-rw-r--r--Lib/test/test_signal.py4
-rw-r--r--Lib/test/test_string.py4
10 files changed, 20 insertions, 19 deletions
diff --git a/Lib/test/README b/Lib/test/README
index c969fcc..94b1964 100644
--- a/Lib/test/README
+++ b/Lib/test/README
@@ -12,7 +12,8 @@ functionality. The mechanics of how the test system operates are fairly
straightforward. When a test case is run, the output is compared with the
expected output that is stored in .../Lib/test/output. If the test runs to
completion and the actual and expected outputs match, the test succeeds, if
-not, it fails. If an ImportError is raised, the test is not run.
+not, it fails. If an ImportError or test_support.TestSkipped error is
+raised, the test is not run.
You will be writing unit tests (isolated tests of functions and objects
defined by the module) using white box techniques. Unlike black box
diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py
index 534fa73..d7f6016 100755
--- a/Lib/test/test_binhex.py
+++ b/Lib/test/test_binhex.py
@@ -6,7 +6,7 @@
"""
import binhex
import tempfile
-from test_support import verbose
+from test_support import verbose, TestSkipped
def test():
@@ -15,7 +15,7 @@ def test():
fname2 = tempfile.mktemp()
f = open(fname1, 'w')
except:
- raise ImportError, "Cannot test binhex without a temp file"
+ raise TestSkipped, "Cannot test binhex without a temp file"
start = 'Jack is my hero'
f.write(start)
diff --git a/Lib/test/test_dl.py b/Lib/test/test_dl.py
index 53c98e6..60a5cf0 100755
--- a/Lib/test/test_dl.py
+++ b/Lib/test/test_dl.py
@@ -4,7 +4,7 @@
"""
import dl
-from test_support import verbose
+from test_support import verbose,TestSkipped
sharedlibs = [
('/usr/lib/libc.so', 'getpid'),
@@ -29,4 +29,4 @@ for s, func in sharedlibs:
print 'worked!'
break
else:
- raise ImportError, 'Could not open any shared libraries'
+ raise TestSkipped, 'Could not open any shared libraries'
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py
index 67e30df..8804392 100644
--- a/Lib/test/test_fork1.py
+++ b/Lib/test/test_fork1.py
@@ -9,11 +9,12 @@ active threads survive in the child after a fork(); this is an error.
"""
import os, sys, time, thread
+from test_support import TestSkipped
try:
os.fork
except AttributeError:
- raise ImportError, "os.fork not defined -- skipping test_fork1"
+ raise TestSkipped, "os.fork not defined -- skipping test_fork1"
LONGSLEEP = 2
diff --git a/Lib/test/test_gl.py b/Lib/test/test_gl.py
index 1010b6f..1282fc4 100755
--- a/Lib/test/test_gl.py
+++ b/Lib/test/test_gl.py
@@ -3,7 +3,7 @@
taken mostly from the documentation.
Roger E. Masse
"""
-from test_support import verbose
+from test_support import verbose, TestSkipped
import gl, GL, time
glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask',
@@ -87,8 +87,7 @@ def main():
try:
display = os.environ['DISPLAY']
except:
- # Raise ImportError because regrtest.py handles it specially.
- raise ImportError, "No $DISPLAY -- skipping gl test"
+ raise TestSkipped, "No $DISPLAY -- skipping gl test"
# touch all the attributes of gl without doing anything
if verbose:
diff --git a/Lib/test/test_nis.py b/Lib/test/test_nis.py
index b73faf9..f711de0 100644
--- a/Lib/test/test_nis.py
+++ b/Lib/test/test_nis.py
@@ -1,4 +1,4 @@
-from test_support import verbose, TestFailed
+from test_support import verbose, TestFailed, TestSkipped
import nis
print 'nis.maps()'
@@ -9,7 +9,7 @@ except nis.error, msg:
if verbose:
raise TestFailed, msg
# only do this if running under the regression suite
- raise ImportError, msg
+ raise TestSkipped, msg
done = 0
for nismap in maps:
diff --git a/Lib/test/test_openpty.py b/Lib/test/test_openpty.py
index 1202845..723e57c 100644
--- a/Lib/test/test_openpty.py
+++ b/Lib/test/test_openpty.py
@@ -1,7 +1,7 @@
# Test to see if openpty works. (But don't worry if it isn't available.)
import os
-from test_support import verbose, TestFailed
+from test_support import verbose, TestFailed, TestSkipped
try:
if verbose:
@@ -10,7 +10,7 @@ try:
if verbose:
print "(master, slave) = (%d, %d)"%(master, slave)
except AttributeError:
- raise ImportError, "No openpty() available."
+ raise TestSkipped, "No openpty() available."
if not os.isatty(master):
raise TestFailed, "Master-end of pty is not a terminal."
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index 5551cd1..295ff3c 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -1,5 +1,5 @@
import pty, os, sys, string
-from test_support import verbose, TestFailed
+from test_support import verbose, TestFailed, TestSkipped
TEST_STRING_1 = "I wish to buy a fish license."
TEST_STRING_2 = "For my pet fish, Eric."
@@ -25,7 +25,7 @@ try:
debug("Got slave_fd '%d'"%slave_fd)
except OSError:
# " An optional feature could not be imported " ... ?
- raise ImportError, "Pseudo-terminals (seemingly) not functional."
+ raise TestSkipped, "Pseudo-terminals (seemingly) not functional."
if not os.isatty(master_fd):
raise TestFailed, "master_fd is not a tty"
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 2d33635..02b5dc3 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1,11 +1,11 @@
# Test the signal module
-from test_support import verbose
+from test_support import verbose, TestSkipped
import signal
import os
import sys
if sys.platform[:3] in ('win', 'os2'):
- raise ImportError, "Can't test signal on %s" % sys.platform[:3]
+ raise TestSkipped, "Can't test signal on %s" % sys.platform[:3]
if verbose:
x = '-x'
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py
index 84842a0..59f8285 100644
--- a/Lib/test/test_string.py
+++ b/Lib/test/test_string.py
@@ -1,4 +1,4 @@
-from test_support import verbose
+from test_support import verbose, TestSkipped
import string_tests
import string, sys
@@ -6,7 +6,7 @@ import string, sys
try:
''.join
except AttributeError:
- raise ImportError
+ raise TestSkipped
def test(name, input, output, *args):
if verbose: