summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_site.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-06-27 03:02:18 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-06-27 03:02:18 (GMT)
commitebd95222bf732f78b3a443d57d00174fbee8904e (patch)
tree66b00eca80991224e00b7d30d2e5c5045e14300b /Lib/test/test_site.py
parenta006c37472ccca46edf6b138a386ff100c621a80 (diff)
downloadcpython-ebd95222bf732f78b3a443d57d00174fbee8904e.zip
cpython-ebd95222bf732f78b3a443d57d00174fbee8904e.tar.gz
cpython-ebd95222bf732f78b3a443d57d00174fbee8904e.tar.bz2
* Silence a test failure that resulted when test_site was run by
regrtest.py after it ran test_frozen. This test was really only designed to be run immediately after startup. Afterwards, other modules could be loaded when had not been fixed-up by site.py Took the chicken way out and only tested those modules known to be imported by site.py. * Normalized whitespace.
Diffstat (limited to 'Lib/test/test_site.py')
-rw-r--r--Lib/test/test_site.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index eb9d4a3..96a64bb 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -21,10 +21,10 @@ else:
class HelperFunctionsTests(unittest.TestCase):
"""Tests for helper functions.
-
+
The setting of the encoding (set using sys.setdefaultencoding) used by
the Unicode implementation is not tested.
-
+
"""
def setUp(self):
@@ -34,7 +34,7 @@ class HelperFunctionsTests(unittest.TestCase):
def tearDown(self):
"""Restore sys.path"""
sys.path = self.sys_path
-
+
def test_makepath(self):
# Test makepath() have an absolute path for its first return value
# and a case-normalized version of the absolute path for its
@@ -55,7 +55,7 @@ class HelperFunctionsTests(unittest.TestCase):
self.failUnless(entry in dir_set,
"%s from sys.path not found in set returned "
"by _init_pathinfo(): %s" % (entry, dir_set))
-
+
def test_addpackage(self):
# Make sure addpackage() imports if the line starts with 'import',
# otherwise add a directory combined from sitedir and 'name'.
@@ -67,7 +67,7 @@ class HelperFunctionsTests(unittest.TestCase):
sys.path)
finally:
cleanuppth(dir_path, file_name, new_dir)
-
+
def test_addsitedir(self):
dir_path, file_name, new_dir = createpth()
try:
@@ -120,11 +120,14 @@ class ImportSideEffectTests(unittest.TestCase):
# as an absolute path.
# Handled by abs__file__()
site.abs__file__()
- for module in sys.modules.values():
+ for module in (sys, os, __builtin__):
try:
- self.failUnless(os.path.isabs(module.__file__))
+ self.failUnless(os.path.isabs(module.__file__), `module`)
except AttributeError:
continue
+ # We could try everything in sys.modules; however, when regrtest.py
+ # runs something like test_frozen before test_site, then we will
+ # be testing things loaded *after* test_site did path normalization
def test_no_duplicate_paths(self):
# No duplicate paths should exist in sys.path