Commit 640b283a authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #1890 from rotu/patch-1

Remove module importing hack
parents 8a821dd9 278e0273
Fix vendored dependencies so importing ``setuptools.extern.some_module`` gives the same object as ``setuptools._vendor.some_module``. This makes Metadata picklable again.
\ No newline at end of file
......@@ -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 prefix and sys.version_info > (3, 3):
del sys.modules[extant]
return mod
except ImportError:
pass
......
......@@ -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
......
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()))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment