summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-06-17 13:43:18 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-06-17 13:43:18 (GMT)
commitc06f46f74c4a5f3cc46aa3a6d1c9cc1cb187e4c4 (patch)
tree9bda96b9c57c5321faf75675b8430b4cf38b47ef
parentd2c7e3fe96b16122fe23e018f970c5518c6411b5 (diff)
downloadcpython-c06f46f74c4a5f3cc46aa3a6d1c9cc1cb187e4c4.zip
cpython-c06f46f74c4a5f3cc46aa3a6d1c9cc1cb187e4c4.tar.gz
cpython-c06f46f74c4a5f3cc46aa3a6d1c9cc1cb187e4c4.tar.bz2
Packaging tests: don’t let an internal cache grow indefinitely.
Victor Stinner diagnosed on #12167 that some reference leaks came from util._path_created, a set used for caching; there are two tests that cause additions to this set, so now they clear it in tearDown, avoiding 17 refleaks. (My tests show that it’s necessary to clear the set in only one test, clearing it in both does not stop more refleaks, but there’s no harm in doing it.)
-rw-r--r--Lib/packaging/tests/test_command_bdist_dumb.py2
-rw-r--r--Lib/packaging/tests/test_uninstall.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/packaging/tests/test_command_bdist_dumb.py b/Lib/packaging/tests/test_command_bdist_dumb.py
index fd199ea..25f3276 100644
--- a/Lib/packaging/tests/test_command_bdist_dumb.py
+++ b/Lib/packaging/tests/test_command_bdist_dumb.py
@@ -1,6 +1,7 @@
"""Tests for distutils.command.bdist_dumb."""
import os
+import packaging.util
from packaging.dist import Distribution
from packaging.command.bdist_dumb import bdist_dumb
@@ -18,6 +19,7 @@ class BuildDumbTestCase(support.TempdirManager,
def tearDown(self):
os.chdir(self.old_location)
+ packaging.util._path_created.clear()
super(BuildDumbTestCase, self).tearDown()
@requires_zlib
diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py
index 00e97e4..0ef7f3b 100644
--- a/Lib/packaging/tests/test_uninstall.py
+++ b/Lib/packaging/tests/test_uninstall.py
@@ -3,6 +3,7 @@ import os
import sys
from io import StringIO
import stat
+import packaging.util
from packaging.database import disable_cache, enable_cache
from packaging.run import main
@@ -43,6 +44,7 @@ class UninstallTestCase(support.TempdirManager,
def tearDown(self):
os.chdir(self.cwd)
+ packaging.util._path_created.clear()
super(UninstallTestCase, self).tearDown()
def run_setup(self, *args):