summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-03-07 17:15:24 -0500
committerGitHub <noreply@github.com>2020-03-07 17:15:24 -0500
commit640b283a932578760375df88c1593fe8afde458a (patch)
tree39584d2bb53842165a503e71d84f10eb3693ec5c /setuptools
parent8a821dd9f2c2aa2b059543e86ede2cb0b4daae5c (diff)
parent278e027348f52fc0dfc7ac6046fd169632922bb1 (diff)
downloadpython-setuptools-git-640b283a932578760375df88c1593fe8afde458a.tar.gz
Merge pull request #1890 from rotu/patch-1
Remove module importing hack
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/extern/__init__.py7
-rw-r--r--setuptools/tests/test_extern.py22
2 files changed, 22 insertions, 7 deletions
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
index e8c616f9..4e79aa17 100644
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -43,13 +43,6 @@ class VendorImporter:
__import__(extant)
mod = sys.modules[extant]
sys.modules[fullname] = mod
- # mysterious hack:
- # Remove the reference to the extant package/module
- # on later Python versions to cause relative imports
- # in the vendor package to resolve the same modules
- # as those going through this importer.
- if sys.version_info >= (3, ):
- del sys.modules[extant]
return mod
except ImportError:
pass
diff --git a/setuptools/tests/test_extern.py b/setuptools/tests/test_extern.py
new file mode 100644
index 00000000..3519a680
--- /dev/null
+++ b/setuptools/tests/test_extern.py
@@ -0,0 +1,22 @@
+import importlib
+import pickle
+
+from setuptools import Distribution
+from setuptools.extern import ordered_set
+from setuptools.tests import py3_only
+
+
+def test_reimport_extern():
+ ordered_set2 = importlib.import_module(ordered_set.__name__)
+ assert ordered_set is ordered_set2
+
+
+def test_orderedset_pickle_roundtrip():
+ o1 = ordered_set.OrderedSet([1, 2, 5])
+ o2 = pickle.loads(pickle.dumps(o1))
+ assert o1 == o2
+
+
+@py3_only
+def test_distribution_picklable():
+ pickle.loads(pickle.dumps(Distribution()))