summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLib/UserString.py6
-rw-r--r--Lib/test/autotest.py2
-rw-r--r--Lib/test/double_const.py2
-rw-r--r--Lib/test/pickletester.py2
-rwxr-xr-xLib/test/regrtest.py26
-rw-r--r--Lib/test/string_tests.py2
-rw-r--r--Lib/test/test___all__.py2
-rwxr-xr-xLib/test/test_al.py2
-rw-r--r--Lib/test/test_atexit.py2
-rw-r--r--Lib/test/test_b1.py2
-rw-r--r--Lib/test/test_b2.py2
-rwxr-xr-xLib/test/test_binascii.py2
-rw-r--r--Lib/test/test_bisect.py2
-rw-r--r--Lib/test/test_bufio.py2
-rw-r--r--Lib/test/test_builtin.py6
-rwxr-xr-xLib/test/test_cd.py2
-rw-r--r--Lib/test/test_cfgparser.py2
-rw-r--r--Lib/test/test_cgi.py2
-rwxr-xr-xLib/test/test_cl.py2
-rw-r--r--Lib/test/test_class.py2
-rw-r--r--Lib/test/test_coercion.py2
-rw-r--r--Lib/test/test_compare.py2
-rw-r--r--Lib/test/test_complex.py2
-rw-r--r--Lib/test/test_contains.py2
-rw-r--r--Lib/test/test_doctest2.py2
-rw-r--r--Lib/test/test_exceptions.py2
-rw-r--r--Lib/test/test_extcall.py2
-rw-r--r--Lib/test/test_file.py2
-rw-r--r--Lib/test/test_frozen.py2
-rw-r--r--Lib/test/test_funcattrs.py2
-rw-r--r--Lib/test/test_future.py16
-rw-r--r--Lib/test/test_getargs.py2
-rwxr-xr-xLib/test/test_gl.py2
-rw-r--r--Lib/test/test_global.py2
-rw-r--r--Lib/test/test_grammar.py2
-rw-r--r--Lib/test/test_gzip.py2
-rw-r--r--Lib/test/test_httplib.py2
-rw-r--r--Lib/test/test_math.py2
-rw-r--r--Lib/test/test_opcodes.py2
-rw-r--r--Lib/test/test_pickle.py2
-rw-r--r--Lib/test/test_re.py2
-rw-r--r--Lib/test/test_sre.py2
-rw-r--r--Lib/test/test_strop.py2
-rw-r--r--Lib/test/test_support.py3
-rw-r--r--Lib/test/test_traceback.py2
-rw-r--r--Lib/test/test_unpack.py2
46 files changed, 79 insertions, 60 deletions
diff --git a/Lib/UserString.py b/Lib/UserString.py
index ed90b8d792..8209820aeb 100755
--- a/Lib/UserString.py
+++ b/Lib/UserString.py
@@ -173,10 +173,8 @@ if __name__ == "__main__":
# execute the regression test to stdout, if called as a script:
import os
called_in_dir, called_as = os.path.split(sys.argv[0])
- called_in_dir = os.path.abspath(called_in_dir)
called_as, py = os.path.splitext(called_as)
- sys.path.append(os.path.join(called_in_dir, 'test'))
if '-q' in sys.argv:
- import test_support
+ from test import test_support
test_support.verbose = 0
- __import__('test_' + called_as.lower())
+ __import__('test.test_' + called_as.lower())
diff --git a/Lib/test/autotest.py b/Lib/test/autotest.py
index 57f371bd4e..41c2088727 100644
--- a/Lib/test/autotest.py
+++ b/Lib/test/autotest.py
@@ -2,5 +2,5 @@
# It can be especially handy if you're in an interactive shell, e.g.,
# from test import autotest.
-import regrtest
+from test import regrtest
regrtest.main()
diff --git a/Lib/test/double_const.py b/Lib/test/double_const.py
index 5ea6de05b8..16c33a19c9 100644
--- a/Lib/test/double_const.py
+++ b/Lib/test/double_const.py
@@ -1,4 +1,4 @@
-from test_support import TestFailed
+from test.test_support import TestFailed
# A test for SF bug 422177: manifest float constants varied way too much in
# precision depending on whether Python was loading a module for the first
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 2576e8fba3..870a8d6569 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1,5 +1,5 @@
import unittest
-from test_support import TestFailed, have_unicode
+from test.test_support import TestFailed, have_unicode
class C:
def __cmp__(self, other):
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 4d71e219a4..1fa5d506d4 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -244,8 +244,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0,
print "All",
print count(len(good), "test"), "OK."
if verbose:
- print "CAUTION: stdout isn't compared in verbose mode: a test"
- print "that passes in verbose mode may fail without it."
+ print "CAUTION: stdout isn't compared in verbose mode:"
+ print "a test that passes in verbose mode may fail without it."
if bad:
print count(len(bad), "test"), "failed:"
printlist(bad)
@@ -338,7 +338,13 @@ def runtest(test, generate, verbose, quiet, testdir = None):
if cfp:
sys.stdout = cfp
print test # Output file starts with test name
- the_module = __import__(test, globals(), locals(), [])
+ if test.startswith('test.'):
+ abstest = test
+ else:
+ # Always import it from the test package
+ abstest = 'test.' + test
+ the_package = __import__(abstest, globals(), locals(), [])
+ the_module = getattr(the_package, test)
# Most tests run to completion simply as a side-effect of
# being imported. For the benefit of tests that can't run
# that way (like test_threaded_import), explicitly invoke
@@ -784,4 +790,18 @@ class _ExpectedSkips:
return self.expected
if __name__ == '__main__':
+ # Remove regrtest.py's own directory from the module search path. This
+ # prevents relative imports from working, and relative imports will screw
+ # up the testing framework. E.g. if both test.test_support and
+ # test_support are imported, they will not contain the same globals, and
+ # much of the testing framework relies on the globals in the
+ # test.test_support module.
+ mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
+ i = pathlen = len(sys.path)
+ while i >= 0:
+ i -= 1
+ if os.path.abspath(os.path.normpath(sys.path[i])) == mydir:
+ del sys.path[i]
+ if len(sys.path) == pathlen:
+ print 'Could not find %r in sys.path to remove it' % mydir
main()
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index b645354a0c..47d7510c07 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -1,7 +1,7 @@
"""Common tests shared by test_string and test_userstring"""
import string
-from test_support import verify, verbose, TestFailed, have_unicode
+from test.test_support import verify, verbose, TestFailed, have_unicode
transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`xyzdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377'
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 01c918cdc1..0a988facf6 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,4 +1,4 @@
-from test_support import verify, verbose
+from test.test_support import verify, verbose
import sys
import warnings
diff --git a/Lib/test/test_al.py b/Lib/test/test_al.py
index d11c7e51ba..66955ba1aa 100755
--- a/Lib/test/test_al.py
+++ b/Lib/test/test_al.py
@@ -3,7 +3,7 @@
Roger E. Masse
"""
import al
-from test_support import verbose
+from test.test_support import verbose
alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams',
'newconfig', 'openport', 'queryparams', 'setparams']
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index 9b93b6815b..c9d72a78cd 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -1,5 +1,5 @@
# Test the atexit module.
-from test_support import TESTFN, vereq
+from test.test_support import TESTFN, vereq
import atexit
from os import popen, unlink
import sys
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py
index cd828b161c..37e7cdf196 100644
--- a/Lib/test/test_b1.py
+++ b/Lib/test/test_b1.py
@@ -1,6 +1,6 @@
# Python test set -- part 4a, built-in functions a-m
-from test_support import *
+from test.test_support import TestFailed, fcmp, have_unicode, TESTFN, unlink
print '__import__'
__import__('sys')
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index a8bc22adb8..b59d3ab698 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -1,6 +1,6 @@
# Python test set -- part 4b, built-in functions n-z
-from test_support import *
+from test.test_support import TestFailed, fcmp, TESTFN, unlink, vereq
print 'oct'
if oct(100) != '0144': raise TestFailed, 'oct(100)'
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index 2c59160128..f1f8b33f59 100755
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -1,6 +1,6 @@
"""Test the binascii C module."""
-from test_support import verify, verbose, have_unicode
+from test.test_support import verify, verbose, have_unicode
import binascii
# Show module doc string
diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py
index 12929156ba..a226537342 100644
--- a/Lib/test/test_bisect.py
+++ b/Lib/test/test_bisect.py
@@ -1,4 +1,4 @@
-from test_support import TestFailed
+from test.test_support import TestFailed
import bisect
import sys
diff --git a/Lib/test/test_bufio.py b/Lib/test/test_bufio.py
index 12359c44d0..611cd695d9 100644
--- a/Lib/test/test_bufio.py
+++ b/Lib/test/test_bufio.py
@@ -1,4 +1,4 @@
-from test_support import verify, TestFailed, TESTFN
+from test.test_support import verify, TestFailed, TESTFN
# Simple test to ensure that optimizations in fileobject.c deliver
# the expected results. For best testing, run this under a debug-build
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 33fef8d1b7..79a395cc06 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1,13 +1,13 @@
# Python test set -- part 4, built-in functions
-from test_support import *
+from test.test_support import unload
print '4. Built-in functions'
print 'test_b1'
unload('test_b1')
-import test_b1
+from test import test_b1
print 'test_b2'
unload('test_b2')
-import test_b2
+from test import test_b2
diff --git a/Lib/test/test_cd.py b/Lib/test/test_cd.py
index 9a45a7d3a7..9a65a7d600 100755
--- a/Lib/test/test_cd.py
+++ b/Lib/test/test_cd.py
@@ -3,7 +3,7 @@
Roger E. Masse
"""
import cd
-from test_support import verbose
+from test.test_support import verbose
cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY',
'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', 'createparser', 'error',
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py
index 6a6fecbfbb..fae8a1788c 100644
--- a/Lib/test/test_cfgparser.py
+++ b/Lib/test/test_cfgparser.py
@@ -1,7 +1,7 @@
import ConfigParser
import StringIO
-from test_support import TestFailed, verify
+from test.test_support import TestFailed, verify
def basic(src):
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index b1f5758a72..980e3b6486 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -1,4 +1,4 @@
-from test_support import verify, verbose
+from test.test_support import verify, verbose
import cgi
import os
import sys
diff --git a/Lib/test/test_cl.py b/Lib/test/test_cl.py
index 26c5146863..d3efe9fbc3 100755
--- a/Lib/test/test_cl.py
+++ b/Lib/test/test_cl.py
@@ -3,7 +3,7 @@
Roger E. Masse
"""
import cl
-from test_support import verbose
+from test.test_support import verbose
clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
'ALGORITHM_VERSION', 'AUDIO', 'AWARE_ERROR', 'AWARE_MPEG_AUDIO',
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 5240b3adfc..e90a790cd4 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -1,6 +1,6 @@
"Test the functionality of Python classes implementing operators."
-from test_support import TestFailed
+from test.test_support import TestFailed
testmeths = [
diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py
index afade35287..be5b744e03 100644
--- a/Lib/test/test_coercion.py
+++ b/Lib/test/test_coercion.py
@@ -113,6 +113,6 @@ def do_prefix_binops():
warnings.filterwarnings("ignore",
r'complex divmod\(\), // and % are deprecated',
DeprecationWarning,
- r'test_coercion$')
+ r'test.test_coercion$')
do_infix_binops()
do_prefix_binops()
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 8100aec7ab..6899926fac 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,7 +1,5 @@
import sys
-from test_support import *
-
class Empty:
def __repr__(self):
return '<Empty>'
diff --git a/Lib/test/test_complex.py b/Lib/test/test_complex.py
index ff7bb14335..8a02f7fce8 100644
--- a/Lib/test/test_complex.py
+++ b/Lib/test/test_complex.py
@@ -1,4 +1,4 @@
-from test_support import TestFailed, vereq
+from test.test_support import TestFailed, vereq
from random import random
# These tests ensure that complex math does the right thing; tests of
diff --git a/Lib/test/test_contains.py b/Lib/test/test_contains.py
index 1a9a965076..9abed1512b 100644
--- a/Lib/test/test_contains.py
+++ b/Lib/test/test_contains.py
@@ -1,4 +1,4 @@
-from test_support import TestFailed, have_unicode
+from test.test_support import TestFailed, have_unicode
class base_set:
diff --git a/Lib/test/test_doctest2.py b/Lib/test/test_doctest2.py
index 31bf6e854c..3593d4199a 100644
--- a/Lib/test/test_doctest2.py
+++ b/Lib/test/test_doctest2.py
@@ -93,7 +93,7 @@ class C(object):
clsm = classmethod(clsm)
def test_main():
- import test_doctest2
+ from test import test_doctest2
EXPECTED = 19
f, t = test_support.run_doctest(test_doctest2)
if t != EXPECTED:
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index c2fbec6dee..24ae9e307a 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -1,6 +1,6 @@
# Python test set -- part 5, built-in exceptions
-from test_support import *
+from test.test_support import TestFailed, TESTFN, unlink
from types import ClassType
import warnings
import sys, traceback
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 1e80387cf4..30439a4669 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -1,4 +1,4 @@
-from test_support import verify, verbose, TestFailed, sortdict
+from test.test_support import verify, verbose, TestFailed, sortdict
from UserList import UserList
def f(*a, **k):
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 261db2ccb6..1eb84185f4 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -2,7 +2,7 @@ import sys
import os
from array import array
-from test_support import verify, TESTFN, TestFailed
+from test.test_support import verify, TESTFN, TestFailed
from UserList import UserList
# verify writelines with instance sequence
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index 3aa91ab9a0..120a85f67a 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -1,6 +1,6 @@
# Test the frozen module defined in frozen.c.
-from test_support import TestFailed
+from test.test_support import TestFailed
import sys, os
try:
diff --git a/Lib/test/test_funcattrs.py b/Lib/test/test_funcattrs.py
index 293b911def..3dc888c501 100644
--- a/Lib/test/test_funcattrs.py
+++ b/Lib/test/test_funcattrs.py
@@ -1,4 +1,4 @@
-from test_support import verbose, TestFailed, verify
+from test.test_support import verbose, TestFailed, verify
import types
class F:
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 62bc8573fc..12813d4b44 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -12,36 +12,36 @@ def check_error_location(msg):
# The first two tests should work
unload('test_future1')
-import test_future1
+from test import test_future1
unload('test_future2')
-import test_future2
+from test import test_future2
unload('test_future3')
-import test_future3
+from test import test_future3
# The remaining tests should fail
try:
- import badsyntax_future3
+ from test import badsyntax_future3
except SyntaxError, msg:
check_error_location(str(msg))
try:
- import badsyntax_future4
+ from test import badsyntax_future4
except SyntaxError, msg:
check_error_location(str(msg))
try:
- import badsyntax_future5
+ from test import badsyntax_future5
except SyntaxError, msg:
check_error_location(str(msg))
try:
- import badsyntax_future6
+ from test import badsyntax_future6
except SyntaxError, msg:
check_error_location(str(msg))
try:
- import badsyntax_future7
+ from test import badsyntax_future7
except SyntaxError, msg:
check_error_location(str(msg))
diff --git a/Lib/test/test_getargs.py b/Lib/test/test_getargs.py
index ff0d36cf57..4ce34bc4fe 100644
--- a/Lib/test/test_getargs.py
+++ b/Lib/test/test_getargs.py
@@ -14,7 +14,7 @@ single case that failed between 2.1 and 2.2a2.
# XXX If the encoding succeeds using the current default encoding,
# this test will fail because it does not test the right part of the
# PyArg_ParseTuple() implementation.
-from test_support import have_unicode
+from test.test_support import have_unicode
import marshal
if have_unicode:
diff --git a/Lib/test/test_gl.py b/Lib/test/test_gl.py
index 61eaa835b4..c9cce77607 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, TestSkipped
+from test.test_support import verbose, TestSkipped
import gl, GL, time
glattrs = ['RGBcolor', 'RGBcursor', 'RGBmode', 'RGBrange', 'RGBwritemask',
diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py
index fb10533ae4..4cc953cd3f 100644
--- a/Lib/test/test_global.py
+++ b/Lib/test/test_global.py
@@ -1,6 +1,6 @@
"""Verify that warnings are issued for global statements following use."""
-from test_support import check_syntax
+from test.test_support import check_syntax
import warnings
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index bb843fb624..c77e19e0f6 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -1,7 +1,7 @@
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
-from test_support import *
+from test.test_support import TestFailed, verify, check_syntax
import sys
print '1. Parser'
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index d42dee6667..9156d9ed62 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -1,4 +1,4 @@
-from test_support import verify
+from test.test_support import verify
import sys, os
import gzip, tempfile
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index f70abec7ea..4d8dbc8997 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1,4 +1,4 @@
-from test_support import verify,verbose
+from test.test_support import verify,verbose
import httplib
import StringIO
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 51013815ff..2d9b55b2f5 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -1,7 +1,7 @@
# Python test set -- math module
# XXXX Should not do tests around zero only
-from test.test_support import *
+from test.test_support import TestFailed, verbose
seps='1e-05'
eps = eval(seps)
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py
index 515df6c1d4..c1929637ac 100644
--- a/Lib/test/test_opcodes.py
+++ b/Lib/test/test_opcodes.py
@@ -1,6 +1,6 @@
# Python test set -- part 2, opcodes
-from test.test_support import *
+from test.test_support import TestFailed
print '2. Opcodes'
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 935a763262..87c73c2478 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -1,7 +1,7 @@
import pickle
import unittest
from cStringIO import StringIO
-from pickletester import AbstractPickleTests, AbstractPickleModuleTests
+from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests
from test import test_support
class PickleTests(AbstractPickleTests, AbstractPickleModuleTests):
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 5475416924..a20c82f682 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -267,7 +267,7 @@ try:
except RuntimeError, v:
print v
-from re_tests import *
+from test.re_tests import *
if verbose:
print 'Running re_tests test suite'
diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py
index 4f2aae84b7..284212c7c7 100644
--- a/Lib/test/test_sre.py
+++ b/Lib/test/test_sre.py
@@ -298,7 +298,7 @@ test("sre.match('(x)*', 50000*'x').span()", (0, 50000), RuntimeError)
test("sre.match(r'(x)*y', 50000*'x'+'y').span()", (0, 50001), RuntimeError)
test("sre.match(r'(x)*?y', 50000*'x'+'y').span()", (0, 50001), RuntimeError)
-from re_tests import *
+from test.re_tests import *
if verbose:
print 'Running re_tests test suite'
diff --git a/Lib/test/test_strop.py b/Lib/test/test_strop.py
index 4f5ba000d7..2ac7986690 100644
--- a/Lib/test/test_strop.py
+++ b/Lib/test/test_strop.py
@@ -1,7 +1,7 @@
import warnings
warnings.filterwarnings("ignore", "strop functions are obsolete;",
DeprecationWarning,
- r'test_strop|unittest')
+ r'test.test_strop|unittest')
import strop
import unittest
from test import test_support
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 4a456179b7..948c64561f 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -1,5 +1,8 @@
"""Supporting definitions for the Python regression test."""
+if __name__ != 'test.test_support':
+ raise ImportError, 'test_support must be imported from the test package'
+
import sys
class Error(Exception):
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 44221188f5..a0b31505a3 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -22,7 +22,7 @@ class TracebackCases(unittest.TestCase):
def syntax_error_without_caret(self):
# XXX why doesn't compile raise the same traceback?
- import badsyntax_nocaret
+ import test.badsyntax_nocaret
def test_caret(self):
err = self.get_exception_format(self.syntax_error_with_caret,
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index fb225645b8..a8fd09c633 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -1,4 +1,4 @@
-from test.test_support import *
+from test.test_support import TestFailed, verbose
t = (1, 2, 3)
l = [4, 5, 6]