mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Merged revisions 84097,84099 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84097 | florent.xicluna | 2010-08-16 20:41:19 +0200 (lun., 16 août 2010) | 1 line Use test.support and unittest features. Fix duplicated test (bad merge in r79033). Fix comment for issue #7902. ........ r84099 | florent.xicluna | 2010-08-16 21:03:05 +0200 (lun., 16 août 2010) | 1 line I get it wrong in r84097: s/relative/absolute/ ........
This commit is contained in:
parent
8a9b22204e
commit
b62a20547a
1 changed files with 15 additions and 12 deletions
|
@ -3,11 +3,10 @@ import marshal
|
||||||
import os
|
import os
|
||||||
import py_compile
|
import py_compile
|
||||||
import random
|
import random
|
||||||
import shutil
|
|
||||||
import stat
|
import stat
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from test.test_support import (unlink, TESTFN, unload, run_unittest,
|
from test.test_support import (unlink, TESTFN, unload, run_unittest, rmtree,
|
||||||
is_jython, check_warnings, EnvironmentVarGuard)
|
is_jython, check_warnings, EnvironmentVarGuard)
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,6 +134,14 @@ class ImportTests(unittest.TestCase):
|
||||||
self.assertIs(orig_path, new_os.path)
|
self.assertIs(orig_path, new_os.path)
|
||||||
self.assertIsNot(orig_getenv, new_os.getenv)
|
self.assertIsNot(orig_getenv, new_os.getenv)
|
||||||
|
|
||||||
|
def test_bug7732(self):
|
||||||
|
source = TESTFN + '.py'
|
||||||
|
os.mkdir(source)
|
||||||
|
try:
|
||||||
|
self.assertRaises(IOError, imp.find_module, TESTFN, ["."])
|
||||||
|
finally:
|
||||||
|
rmtree(source)
|
||||||
|
|
||||||
def test_module_with_large_stack(self, module='longlist'):
|
def test_module_with_large_stack(self, module='longlist'):
|
||||||
# Regression test for http://bugs.python.org/issue561858.
|
# Regression test for http://bugs.python.org/issue561858.
|
||||||
filename = module + os.extsep + 'py'
|
filename = module + os.extsep + 'py'
|
||||||
|
@ -290,8 +297,7 @@ func_filename = func.func_code.co_filename
|
||||||
unload(self.module_name)
|
unload(self.module_name)
|
||||||
unlink(self.file_name)
|
unlink(self.file_name)
|
||||||
unlink(self.compiled_name)
|
unlink(self.compiled_name)
|
||||||
if os.path.exists(self.dir_name):
|
rmtree(self.dir_name)
|
||||||
shutil.rmtree(self.dir_name)
|
|
||||||
|
|
||||||
def import_module(self):
|
def import_module(self):
|
||||||
ns = globals()
|
ns = globals()
|
||||||
|
@ -354,7 +360,7 @@ class PathsTests(unittest.TestCase):
|
||||||
self.syspath = sys.path[:]
|
self.syspath = sys.path[:]
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
shutil.rmtree(self.path)
|
rmtree(self.path)
|
||||||
sys.path[:] = self.syspath
|
sys.path[:] = self.syspath
|
||||||
|
|
||||||
# Regression test for http://bugs.python.org/issue1293.
|
# Regression test for http://bugs.python.org/issue1293.
|
||||||
|
@ -432,16 +438,13 @@ class RelativeImportTests(unittest.TestCase):
|
||||||
self.assertRaises(ValueError, check_relative)
|
self.assertRaises(ValueError, check_relative)
|
||||||
|
|
||||||
def test_absolute_import_without_future(self):
|
def test_absolute_import_without_future(self):
|
||||||
# If absolute import syntax is used, then do not try to perform
|
# If explicit relative import syntax is used, then do not try
|
||||||
# a relative import in the face of failure.
|
# to perform an absolute import in the face of failure.
|
||||||
# Issue #7902.
|
# Issue #7902.
|
||||||
try:
|
with self.assertRaises(ImportError):
|
||||||
from .os import sep
|
from .os import sep
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.fail("explicit relative import triggered an "
|
self.fail("explicit relative import triggered an "
|
||||||
"implicit relative import")
|
"implicit absolute import")
|
||||||
|
|
||||||
|
|
||||||
def test_main(verbose=None):
|
def test_main(verbose=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue