Skip to content

Commit f31144a

Browse files
committed
Test for changing container_image at project level
1 parent a151cde commit f31144a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

readthedocs/rtd_tests/tests/test_doc_building.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,32 @@ def test_is_obsolete_with_json_different_build_image(self):
919919
exists.return_value = True
920920
self.assertTrue(python_env.is_obsolete)
921921

922+
def test_is_obsolete_with_project_different_build_image(self):
923+
config_data = {
924+
'build': {
925+
'image': '2.0',
926+
},
927+
'python': {
928+
'version': 2.7,
929+
},
930+
}
931+
yaml_config = create_load(config_data)()[0]
932+
config = ConfigWrapper(version=self.version, yaml_config=yaml_config)
933+
934+
# Set container_image manually
935+
self.pip.container_image = 'readthedocs/build:latest'
936+
self.pip.save()
937+
938+
python_env = Virtualenv(
939+
version=self.version,
940+
build_env=None,
941+
config=config,
942+
)
943+
env_json_data = '{"build": {"image": "readthedocs/build:2.0"}, "python": {"version": 2.7}}'
944+
with patch('os.path.exists') as exists, patch('readthedocs.doc_builder.python_environments.open', mock_open(read_data=env_json_data)) as _open: # noqa
945+
exists.return_value = True
946+
self.assertTrue(python_env.is_obsolete)
947+
922948
def test_is_obsolete_with_json_same_data_as_version(self):
923949
config_data = {
924950
'build': {

0 commit comments

Comments
 (0)