diff options
| author | Benoit Pierre <benoit.pierre@gmail.com> | 2017-08-05 18:31:53 +0200 |
|---|---|---|
| committer | Benoit Pierre <benoit.pierre@gmail.com> | 2017-08-05 20:58:20 +0200 |
| commit | e5461b6ccc57596c7e9cf7837084f8a20eeec9b7 (patch) | |
| tree | af500bb4322e27a522db452fabd0e401fc61afb6 /setuptools/tests/test_dist.py | |
| parent | aa41a7a58d0e1cd0dd6715b2d4057666410114c7 (diff) | |
| download | python-setuptools-git-e5461b6ccc57596c7e9cf7837084f8a20eeec9b7.tar.gz | |
workaround easy_install bug
Don't reuse `easy_install` command in `Distribution.fetch_build_egg` implementation.
Fix #196.
Diffstat (limited to 'setuptools/tests/test_dist.py')
| -rw-r--r-- | setuptools/tests/test_dist.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py new file mode 100644 index 00000000..435ffec0 --- /dev/null +++ b/setuptools/tests/test_dist.py @@ -0,0 +1,46 @@ +from setuptools import Distribution +from setuptools.extern.six.moves.urllib.request import pathname2url +from setuptools.extern.six.moves.urllib_parse import urljoin + +from .textwrap import DALS +from .test_easy_install import make_nspkg_sdist + + +def test_dist_fetch_build_egg(tmpdir): + """ + Check multiple calls to `Distribution.fetch_build_egg` work as expected. + """ + index = tmpdir.mkdir('index') + index_url = urljoin('file://', pathname2url(str(index))) + def sdist_with_index(distname, version): + dist_dir = index.mkdir(distname) + dist_sdist = '%s-%s.tar.gz' % (distname, version) + make_nspkg_sdist(str(dist_dir.join(dist_sdist)), distname, version) + with dist_dir.join('index.html').open('w') as fp: + fp.write(DALS( + ''' + <!DOCTYPE html><html><body> + <a href="{dist_sdist}" rel="internal">{dist_sdist}</a><br/> + </body></html> + ''' + ).format(dist_sdist=dist_sdist)) + sdist_with_index('barbazquux', '3.2.0') + sdist_with_index('barbazquux-runner', '2.11.1') + with tmpdir.join('setup.cfg').open('w') as fp: + fp.write(DALS( + ''' + [easy_install] + index_url = {index_url} + ''' + ).format(index_url=index_url)) + reqs = ''' + barbazquux-runner + barbazquux + '''.split() + with tmpdir.as_cwd(): + dist = Distribution() + resolved_dists = [ + dist.fetch_build_egg(r) + for r in reqs + ] + assert [dist.key for dist in resolved_dists if dist] == reqs |
