diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2015-11-28 13:00:32 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-11-28 13:00:32 -0500 |
| commit | 9744cf2edf82eeda796ca22bf21ac0056c8aa925 (patch) | |
| tree | 8b71b28065750d9c6388894773a16c7c174d79b9 /pkg_resources | |
| parent | 41868fe7c4f75708b3cb663bf1b76405223869b0 (diff) | |
| download | python-setuptools-git-9744cf2edf82eeda796ca22bf21ac0056c8aa925.tar.gz | |
Rewrite test to use distutils' install_egg_info to generate the metadata.
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 8b9a317a..0a03dd93 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -6,9 +6,10 @@ import datetime import time import subprocess import stat +import distutils.dist +import distutils.command.install_egg_info import pytest -import py import pkg_resources @@ -117,7 +118,7 @@ class TestIndependence: -class TestDeepVersionLookup(object): +class TestDeepVersionLookupDistutils(object): @pytest.fixture def env(self, tmpdir): @@ -140,16 +141,16 @@ class TestDeepVersionLookup(object): def create_foo_pkg(self, env, version): """ - Create a foo package installed to env.paths['lib'] + Create a foo package installed (distutils-style) to env.paths['lib'] as version. """ - safe_version = pkg_resources.safe_version(version) - lib = py.path.local(env.paths['lib']) - egg_info = lib / 'foo-' + safe_version + '.egg-info' - egg_info.mkdir() - pkg_info = egg_info / 'PKG_INFO' - with pkg_info.open('w') as strm: - strm.write('version: ' + version) + attrs = dict(name='foo', version=version) + dist = distutils.dist.Distribution(attrs) + iei_cmd = distutils.command.install_egg_info.install_egg_info(dist) + iei_cmd.initialize_options() + iei_cmd.install_dir = env.paths['lib'] + iei_cmd.finalize_options() + iei_cmd.run() def test_version_resolved_from_egg_info(self, env): version = '1.11.0.dev0+2329eae' |
