Kaydet (Commit) ef316572 authored tarafından Nick Coghlan's avatar Nick Coghlan

Issue 10971: Make test_zipimport_support once again compatible with refleak…

Issue 10971: Make test_zipimport_support once again compatible with refleak hunting (reviewed by Georg Brandl)
üst 555f2883
...@@ -93,7 +93,10 @@ class ZipSupportTests(unittest.TestCase): ...@@ -93,7 +93,10 @@ class ZipSupportTests(unittest.TestCase):
os.remove(init_name) os.remove(init_name)
sys.path.insert(0, zip_name) sys.path.insert(0, zip_name)
import zip_pkg import zip_pkg
try:
self.assertEqual(inspect.getsource(zip_pkg.foo), test_src) self.assertEqual(inspect.getsource(zip_pkg.foo), test_src)
finally:
del sys.modules["zip_pkg"]
def test_doctest_issue4197(self): def test_doctest_issue4197(self):
# To avoid having to keep two copies of the doctest module's # To avoid having to keep two copies of the doctest module's
...@@ -128,6 +131,7 @@ class ZipSupportTests(unittest.TestCase): ...@@ -128,6 +131,7 @@ class ZipSupportTests(unittest.TestCase):
os.remove(script_name) os.remove(script_name)
sys.path.insert(0, zip_name) sys.path.insert(0, zip_name)
import test_zipped_doctest import test_zipped_doctest
try:
# Some of the doc tests depend on the colocated text files # Some of the doc tests depend on the colocated text files
# which aren't available to the zipped version (the doctest # which aren't available to the zipped version (the doctest
# module currently requires real filenames for non-embedded # module currently requires real filenames for non-embedded
...@@ -175,6 +179,8 @@ class ZipSupportTests(unittest.TestCase): ...@@ -175,6 +179,8 @@ class ZipSupportTests(unittest.TestCase):
] ]
for obj in known_good_tests: for obj in known_good_tests:
_run_object_doctest(obj, test_zipped_doctest) _run_object_doctest(obj, test_zipped_doctest)
finally:
del sys.modules["test_zipped_doctest"]
def test_doctest_main_issue4197(self): def test_doctest_main_issue4197(self):
test_src = textwrap.dedent("""\ test_src = textwrap.dedent("""\
......
...@@ -31,6 +31,12 @@ Build ...@@ -31,6 +31,12 @@ Build
- Issue #11121: Fix building with --enable-shared. - Issue #11121: Fix building with --enable-shared.
Tests
-----
- Issue #10971:test_zipimport_support is once again compatible with the
refleak hunter feature of test.regrtest.
What's New in Python 3.2 Release Candidate 2? What's New in Python 3.2 Release Candidate 2?
============================================= =============================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment