From e0e02ba96d8ee3b7be76adeec1ec9b9c3c004516 Mon Sep 17 00:00:00 2001 From: Erik Bray Date: Thu, 31 Dec 2015 13:36:36 -0500 Subject: Adds the regression test for distribute issue 323 that I attached to #207. This is to ensure that any fix to #207 does not introduce another regression. --- setuptools/tests/contexts.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'setuptools/tests/contexts.py') diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py index 8c9a2d3e..ae28c7c3 100644 --- a/setuptools/tests/contexts.py +++ b/setuptools/tests/contexts.py @@ -6,6 +6,7 @@ import contextlib import site from setuptools.extern import six +import pkg_resources @contextlib.contextmanager @@ -77,6 +78,18 @@ def save_user_site_setting(): site.ENABLE_USER_SITE = saved +@contextlib.contextmanager +def save_pkg_resources_state(): + pr_state = pkg_resources.__getstate__() + # also save sys.path + sys_path = sys.path[:] + try: + yield pr_state, sys_path + finally: + sys.path[:] = sys_path + pkg_resources.__setstate__(pr_state) + + @contextlib.contextmanager def suppress_exceptions(*excs): try: -- cgit v1.2.1