@@ -724,20 +724,26 @@ def test_pip_install_target():
724
724
"./mock_dir" , ["six" , "--no-cache-dir" ], force = False , sys_path = None
725
725
)
726
726
assert time .time () - start_time > 0.1
727
- sys .modules .pop ("six" , None )
728
- import six
727
+ try :
728
+ sys .modules .pop ("six" , None )
729
+ import six
729
730
730
- assert "mock_dir" not in six .__file__
731
+ assert "mock_dir" not in six .__file__
732
+ except ImportError :
733
+ pass
731
734
# hit md5 cache, force=False, sys_path ignored
732
735
start_time = time .time ()
733
736
assert not pip_install_target (
734
737
"./mock_dir" , ["six" , "--no-cache-dir" ], force = False , sys_path = 0
735
738
)
736
739
assert time .time () - start_time < 0.1
737
- sys .modules .pop ("six" , None )
738
- import six
740
+ try :
741
+ sys .modules .pop ("six" , None )
742
+ import six
739
743
740
- assert "mock_dir" not in six .__file__
744
+ assert "mock_dir" not in six .__file__
745
+ except ImportError :
746
+ pass
741
747
# test force=True, sys_path=0 worked
742
748
start_time = time .time ()
743
749
assert pip_install_target (
@@ -759,7 +765,7 @@ def main():
759
765
count = 0
760
766
items = list (globals ().items ())
761
767
total = len (items )
762
- name_list = ''
768
+ name_list = ""
763
769
for name , func in items :
764
770
if name_list and name not in name_list :
765
771
continue
0 commit comments