@@ -744,6 +744,44 @@ def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir):
744
744
eggs = list (map (str , pkg_resources .find_distributions (os .path .join (test_pkg , '.eggs' ))))
745
745
assert eggs == ['dep 1.0' ]
746
746
747
+ @pytest .mark .parametrize ('use_legacy_installer,with_dependency_links_in_setup_py' ,
748
+ itertools .product ((False , True ), (False , True )))
749
+ def test_setup_requires_with_find_links_in_setup_cfg (self , monkeypatch ,
750
+ use_legacy_installer ,
751
+ with_dependency_links_in_setup_py ):
752
+ monkeypatch .setenv (str ('PIP_RETRIES' ), str ('0' ))
753
+ monkeypatch .setenv (str ('PIP_TIMEOUT' ), str ('0' ))
754
+ with contexts .save_pkg_resources_state ():
755
+ with contexts .tempdir () as temp_dir :
756
+ make_trivial_sdist (os .path .join (temp_dir , 'python-xlib-42.tar.gz' ), 'python-xlib' , '42' )
757
+ test_pkg = os .path .join (temp_dir , 'test_pkg' )
758
+ test_setup_py = os .path .join (test_pkg , 'setup.py' )
759
+ test_setup_cfg = os .path .join (test_pkg , 'setup.cfg' )
760
+ os .mkdir (test_pkg )
761
+ with open (test_setup_py , 'w' ) as fp :
762
+ if with_dependency_links_in_setup_py :
763
+ dependency_links = [os .path .join (temp_dir , 'links' )]
764
+ else :
765
+ dependency_links = []
766
+ fp .write (DALS (
767
+ '''
768
+ from setuptools import installer, setup
769
+ if {use_legacy_installer}:
770
+ installer.fetch_build_egg = installer._legacy_fetch_build_egg
771
+ setup(setup_requires='python-xlib==42',
772
+ dependency_links={dependency_links!r})
773
+ ''' ).format (use_legacy_installer = use_legacy_installer ,
774
+ dependency_links = dependency_links ))
775
+ with open (test_setup_cfg , 'w' ) as fp :
776
+ fp .write (DALS (
777
+ '''
778
+ [easy_install]
779
+ index_url = {index_url}
780
+ find_links = {find_links}
781
+ ''' ).format (index_url = os .path .join (temp_dir , 'index' ),
782
+ find_links = temp_dir ))
783
+ run_setup (test_setup_py , [str ('--version' )])
784
+
747
785
748
786
def make_trivial_sdist (dist_path , distname , version ):
749
787
"""
0 commit comments