From bb00976fbf26f29ab72eeb6afc2d7b4fa1944965 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 20 May 2011 20:27:54 +0300 Subject: [PATCH] Fix another ResourceWarning in test_packaging. --- Lib/packaging/tests/pypi_server.py | 3 ++- Lib/packaging/tests/test_pypi_simple.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/packaging/tests/pypi_server.py b/Lib/packaging/tests/pypi_server.py index d22f5c3ab78..6a72afbdca7 100644 --- a/Lib/packaging/tests/pypi_server.py +++ b/Lib/packaging/tests/pypi_server.py @@ -149,7 +149,8 @@ class PyPIServer(threading.Thread): def stop(self): """self shutdown is not supported for python < 2.6""" self._run = False - self.join() + if self.is_alive(): + self.join() self.server.server_close() def get_next_response(self): diff --git a/Lib/packaging/tests/test_pypi_simple.py b/Lib/packaging/tests/test_pypi_simple.py index c43a8390fc8..6f0d8d9d7b2 100644 --- a/Lib/packaging/tests/test_pypi_simple.py +++ b/Lib/packaging/tests/test_pypi_simple.py @@ -233,6 +233,7 @@ class SimpleCrawlerTestCase(TempdirManager, self.assertEqual(4, len(crawler.get_releases("foo"))) finally: mirror.stop() + server.stop() def test_simple_link_matcher(self): # Test that the simple link matcher finds the right links"""