summaryrefslogtreecommitdiffstats
path: root/Lib/test/README
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-07-23 19:04:11 (GMT)
committerBarry Warsaw <barry@python.org>2002-07-23 19:04:11 (GMT)
commit04f357cffef6d764f2f0ff2671dabde75ec250d1 (patch)
tree8a96259e63e7521bae8a1549bb9469b716dc231d /Lib/test/README
parent62b1ab1b314653c09757c533883447eda437306f (diff)
downloadcpython-04f357cffef6d764f2f0ff2671dabde75ec250d1.zip
cpython-04f357cffef6d764f2f0ff2671dabde75ec250d1.tar.gz
cpython-04f357cffef6d764f2f0ff2671dabde75ec250d1.tar.bz2
Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
Diffstat (limited to 'Lib/test/README')
-rw-r--r--Lib/test/README38
1 files changed, 12 insertions, 26 deletions
diff --git a/Lib/test/README b/Lib/test/README
index 0aa2b1e..13e740c 100644
--- a/Lib/test/README
+++ b/Lib/test/README
@@ -52,7 +52,7 @@ All PyUnit-based tests in the Python test suite use boilerplate that
looks like this:
import unittest
- import test_support
+ from test import test_support
class MyTestCase1(unittest.TestCase):
# define test methods here...
@@ -248,7 +248,7 @@ these mostly apply only to the "classic" tests; unittest- and doctest-
based tests should follow the conventions natural to those frameworks):
* If your test case detects a failure, raise TestFailed (found in
- test_support).
+ test.test_support).
* Import everything you'll need as early as possible.
@@ -275,8 +275,16 @@ based tests should follow the conventions natural to those frameworks):
Miscellaneous
-There is a test_support module you can import from your test case. It
-provides the following useful objects:
+There is a test_support module in the test package you can import from
+your test case. Import this module using either
+
+ import test.test_support
+
+or
+
+ from test import test_support
+
+test_support provides the following useful objects:
* TestFailed - raise this exception when your regression test detects a
failure.
@@ -318,28 +326,6 @@ provides the following useful objects:
numbers when you expect them to only be approximately equal withing a
fuzz factor (test_support.FUZZ, which defaults to 1e-6).
-NOTE: Always import something from test_support like so:
-
- from test_support import verbose
-
-or like so:
-
- import test_support
- ... use test_support.verbose in the code ...
-
-Never import anything from test_support like this:
-
- from test.test_support import verbose
-
-"test" is a package already, so can refer to modules it contains without
-"test." qualification. If you do an explicit "test.xxx" qualification, that
-can fool Python into believing test.xxx is a module distinct from the xxx
-in the current package, and you can end up importing two distinct copies of
-xxx. This is especially bad if xxx=test_support, as regrtest.py can (and
-routinely does) overwrite its "verbose" and "use_large_resources"
-attributes: if you get a second copy of test_support loaded, it may not
-have the same values for those as regrtest intended.
-
Python and C statement coverage results are currently available at