@@ -1133,12 +1133,38 @@ def test_python_install_check_default(self, tmpdir):
1133
1133
assert install [0 ].method == PIP
1134
1134
assert install [0 ].extra_requirements == []
1135
1135
1136
+ def test_python_install_path_check_invalid (self , tmpdir ):
1137
+ build = self .get_build_config (
1138
+ {
1139
+ 'python' : {
1140
+ 'install' : [{
1141
+ 'path' : 'noexists' ,
1142
+ 'method' : 'pip' ,
1143
+ }],
1144
+ },
1145
+ },
1146
+ source_file = str (tmpdir .join ('readthedocs.yml' )),
1147
+ )
1148
+ with raises (InvalidConfig ) as excinfo :
1149
+ build .validate ()
1150
+ assert excinfo .value .key == 'python.install.0.path'
1151
+
1136
1152
@pytest .mark .parametrize ('value' , ['invalid' , 'apt' ])
1137
- def test_python_install_check_invalid (self , value ):
1138
- build = self .get_build_config ({'python' : {'install' : value }},)
1153
+ def test_python_install_method_check_invalid (self , value , tmpdir ):
1154
+ build = self .get_build_config (
1155
+ {
1156
+ 'python' : {
1157
+ 'install' : [{
1158
+ 'path' : '.' ,
1159
+ 'method' : value ,
1160
+ }],
1161
+ },
1162
+ },
1163
+ source_file = str (tmpdir .join ('readthedocs.yml' )),
1164
+ )
1139
1165
with raises (InvalidConfig ) as excinfo :
1140
1166
build .validate ()
1141
- assert excinfo .value .key == 'python.install'
1167
+ assert excinfo .value .key == 'python.install.0.method '
1142
1168
1143
1169
def test_python_install_requirements_check_valid (self , tmpdir ):
1144
1170
apply_fs (tmpdir , {'requirements.txt' : '' })
@@ -1973,6 +1999,20 @@ def test_submodules_recursive_explict_default(self):
1973
1999
}
1974
2000
},
1975
2001
'build.extra'
2002
+ ),
2003
+ (
2004
+ {
2005
+ 'python' : {
2006
+ 'install' : [{
2007
+ 'path' : '.' ,
2008
+ }, {
2009
+ 'path' : '.' ,
2010
+ 'method' : 'pip' ,
2011
+ 'invalid' : 'key' ,
2012
+ }]
2013
+ }
2014
+ },
2015
+ 'python.install.1.invalid'
1976
2016
)
1977
2017
])
1978
2018
def test_strict_validation (self , value , key ):
0 commit comments