From 9b13614de9c0728a3951f3be2e98b5d09e4314f2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 24 Dec 2014 16:45:17 -0500 Subject: Add test making explicit the expectation that pkg_resources shouldn't import setuptools (or be dependent on it in any way). Ref #311. --- tests/test_pkg_resources.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/test_pkg_resources.py') 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) -- cgit v1.2.3 From fb1b7680cee8b4e751b29f6d46a6fcedb51e4e31 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Fri, 2 Jan 2015 15:31:47 -0600 Subject: Fix regression in entry-point name parsing See #323 for more details. --- tests/test_pkg_resources.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/test_pkg_resources.py') diff --git a/tests/test_pkg_resources.py b/tests/test_pkg_resources.py index 564d7cec..4dfd14b3 100644 --- a/tests/test_pkg_resources.py +++ b/tests/test_pkg_resources.py @@ -109,3 +109,11 @@ class TestIndependence: ) cmd = [sys.executable, '-c', '; '.join(lines)] subprocess.check_call(cmd) + + +class TestEntryPoint: + """Tests that ensure EntryPoint behaviour doesn't regress.""" + def test_accepts_old_entry_points(self): + """https://bitbucket.org/pypa/setuptools/issue/323/install-issues-with-102""" + entry_point_string = 'html+mako = mako.ext.pygmentplugin:MakoHtmlLexer' + pkg_resources.EntryPoint.parse(entry_point_string) -- cgit v1.2.3 From ef428d7278002b558541300fb7b7a96c8dbac830 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 16:45:16 -0500 Subject: Move tests to be adjacent with other parsing tests. --- tests/test_pkg_resources.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'tests/test_pkg_resources.py') diff --git a/tests/test_pkg_resources.py b/tests/test_pkg_resources.py index 4dfd14b3..564d7cec 100644 --- a/tests/test_pkg_resources.py +++ b/tests/test_pkg_resources.py @@ -109,11 +109,3 @@ class TestIndependence: ) cmd = [sys.executable, '-c', '; '.join(lines)] subprocess.check_call(cmd) - - -class TestEntryPoint: - """Tests that ensure EntryPoint behaviour doesn't regress.""" - def test_accepts_old_entry_points(self): - """https://bitbucket.org/pypa/setuptools/issue/323/install-issues-with-102""" - entry_point_string = 'html+mako = mako.ext.pygmentplugin:MakoHtmlLexer' - pkg_resources.EntryPoint.parse(entry_point_string) -- cgit v1.2.3