diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-24 16:45:17 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-12-24 16:45:17 -0500 |
commit | 9b13614de9c0728a3951f3be2e98b5d09e4314f2 (patch) | |
tree | 8d98051ed9f011e39783bac5f55c68a38f1ad36c | |
parent | 7bcbb5cbc893e97109c15cba3ea561aa0d462148 (diff) | |
download | external_python_setuptools-9b13614de9c0728a3951f3be2e98b5d09e4314f2.tar.gz external_python_setuptools-9b13614de9c0728a3951f3be2e98b5d09e4314f2.tar.bz2 external_python_setuptools-9b13614de9c0728a3951f3be2e98b5d09e4314f2.zip |
Add test making explicit the expectation that pkg_resources shouldn't import setuptools (or be dependent on it in any way). Ref #311.
-rw-r--r-- | tests/test_pkg_resources.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_pkg_resources.py b/tests/test_pkg_resources.py index 11edfe85..564d7cec 100644 --- a/tests/test_pkg_resources.py +++ b/tests/test_pkg_resources.py @@ -4,6 +4,7 @@ import os import zipfile import datetime import time +import subprocess import pkg_resources @@ -89,3 +90,22 @@ class TestResourceManager(object): type_ = str(type(path)) message = "Unexpected type from get_cache_path: " + type_ assert isinstance(path, (unicode, str)), message + + +class TestIndependence: + """ + Tests to ensure that pkg_resources runs independently from setuptools. + """ + def test_setuptools_not_imported(self): + """ + In a separate Python environment, import pkg_resources and assert + that action doesn't cause setuptools to be imported. + """ + lines = ( + 'import pkg_resources', + 'import sys', + 'assert "setuptools" not in sys.modules, ' + '"setuptools was imported"', + ) + cmd = [sys.executable, '-c', '; '.join(lines)] + subprocess.check_call(cmd) |