@@ -1076,3 +1076,67 @@ def test_double_install_fail(script, data):
1076
1076
msg = ("Double requirement given: pip==7.1.2 (already in pip==*, "
1077
1077
"name='pip')" )
1078
1078
assert msg in result .stderr
1079
+
1080
+
1081
+ def test_install_incompatible_python_requires (script ):
1082
+ script .scratch_path .join ("pkga" ).mkdir ()
1083
+ pkga_path = script .scratch_path / 'pkga'
1084
+ pkga_path .join ("setup.py" ).write (textwrap .dedent ("""
1085
+ from setuptools import setup
1086
+ setup(name='pkga',
1087
+ python_requires='<1.0',
1088
+ version='0.1')
1089
+ """ ))
1090
+ script .pip ('install' , 'setuptools>24.2' ) # This should not be needed
1091
+ result = script .pip ('install' , pkga_path , expect_error = True )
1092
+ assert ("pkga requires Python '<1.0' "
1093
+ "but the running Python is " ) in result .stderr
1094
+
1095
+
1096
+ def test_install_incompatible_python_requires_editable (script ):
1097
+ script .scratch_path .join ("pkga" ).mkdir ()
1098
+ pkga_path = script .scratch_path / 'pkga'
1099
+ pkga_path .join ("setup.py" ).write (textwrap .dedent ("""
1100
+ from setuptools import setup
1101
+ setup(name='pkga',
1102
+ python_requires='<1.0',
1103
+ version='0.1')
1104
+ """ ))
1105
+ script .pip ('install' , 'setuptools>24.2' ) # This should not be needed
1106
+ result = script .pip (
1107
+ 'install' , '--editable=%s' % pkga_path , expect_error = True )
1108
+ assert ("pkga requires Python '<1.0' "
1109
+ "but the running Python is " ) in result .stderr
1110
+
1111
+
1112
+ def test_install_incompatible_python_requires_wheel (script ):
1113
+ script .scratch_path .join ("pkga" ).mkdir ()
1114
+ pkga_path = script .scratch_path / 'pkga'
1115
+ pkga_path .join ("setup.py" ).write (textwrap .dedent ("""
1116
+ from setuptools import setup
1117
+ setup(name='pkga',
1118
+ python_requires='<1.0',
1119
+ version='0.1')
1120
+ """ ))
1121
+ script .pip ('install' , 'setuptools>24.2' ) # This should not be needed
1122
+ script .pip ('install' , 'wheel' )
1123
+ script .run (
1124
+ 'python' , 'setup.py' , 'bdist_wheel' , '--universal' , cwd = pkga_path )
1125
+ result = script .pip ('install' , './pkga/dist/pkga-0.1-py2.py3-none-any.whl' ,
1126
+ expect_error = True )
1127
+ assert ("pkga requires Python '<1.0' "
1128
+ "but the running Python is " ) in result .stderr
1129
+
1130
+
1131
+ def test_install_compatible_python_requires (script ):
1132
+ script .scratch_path .join ("pkga" ).mkdir ()
1133
+ pkga_path = script .scratch_path / 'pkga'
1134
+ pkga_path .join ("setup.py" ).write (textwrap .dedent ("""
1135
+ from setuptools import setup
1136
+ setup(name='pkga',
1137
+ python_requires='>1.0',
1138
+ version='0.1')
1139
+ """ ))
1140
+ script .pip ('install' , 'setuptools>24.2' ) # This should not be needed
1141
+ res = script .pip ('install' , pkga_path , expect_error = True )
1142
+ assert "Successfully installed pkga-0.1" in res .stdout , res
0 commit comments