Skip to content

Commit 64d39db

Browse files
committed
Mores tests
1 parent 0e455b1 commit 64d39db

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

readthedocs/config/tests/test_config.py

+43-3
Original file line numberDiff line numberDiff line change
@@ -1133,12 +1133,38 @@ def test_python_install_check_default(self, tmpdir):
11331133
assert install[0].method == PIP
11341134
assert install[0].extra_requirements == []
11351135

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+
11361152
@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+
)
11391165
with raises(InvalidConfig) as excinfo:
11401166
build.validate()
1141-
assert excinfo.value.key == 'python.install'
1167+
assert excinfo.value.key == 'python.install.0.method'
11421168

11431169
def test_python_install_requirements_check_valid(self, tmpdir):
11441170
apply_fs(tmpdir, {'requirements.txt': ''})
@@ -1973,6 +1999,20 @@ def test_submodules_recursive_explict_default(self):
19731999
}
19742000
},
19752001
'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'
19762016
)
19772017
])
19782018
def test_strict_validation(self, value, key):

0 commit comments

Comments
 (0)