@@ -371,7 +371,12 @@ def test_image_builder_write_dockerfile(tmp_path):
371371
372372@patch ("docker.from_env" )
373373@pytest .mark .parametrize ("set_env" , [False , True ])
374- def test_image_builder_build_skip_build (from_env_mock , tmp_path , set_env ):
374+ @pytest .mark .parametrize ("skip_build" , [False , True ])
375+ def test_image_builder_build_dir (from_env_mock , tmp_path , set_env , skip_build ):
376+ client_mock = Mock (docker .client .DockerClient )
377+ client_mock .images .build .return_value = None , None
378+ from_env_mock .return_value = client_mock
379+
375380 build_dir = tmp_path / "build"
376381 env_path = tmp_path / "env2.yaml"
377382 env_def = {
@@ -386,8 +391,11 @@ def test_image_builder_build_skip_build(from_env_mock, tmp_path, set_env):
386391 build_dir ,
387392 None ,
388393 )
389- image_builder .build (skip_build = True )
390- from_env_mock .assert_not_called ()
394+ image_builder .build (skip_build = skip_build )
395+ if skip_build :
396+ from_env_mock .assert_not_called ()
397+ else :
398+ client_mock .images .build .assert_called ()
391399 env_path = build_dir / "environment.yml"
392400 assert env_path .is_file ()
393401 output_env = yaml .safe_load (env_path .read_text ())
0 commit comments