File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -53,18 +53,23 @@ def test_runner_init_invalid_image_type():
5353 xcengine .core .ContainerRunner (666 , pathlib .Path ("/foo" ))
5454
5555
56- def test_runner_init_with_string ():
56+ @patch ("docker.from_env" )
57+ @pytest .mark .parametrize ("pass_client" , [False , True ])
58+ def test_runner_init_with_string (from_env_mock , pass_client ):
5759 image_name = "foo"
5860 image_mock = Mock (docker .models .images .Image )
5961 client_mock = Mock (docker .client .DockerClient )
62+ from_env_mock .return_value = client_mock
6063
6164 def get_mock (name ):
6265 assert name == image_name
6366 return image_mock
6467
6568 client_mock .images .get = get_mock
6669 runner = xcengine .core .ContainerRunner (
67- image_name , pathlib .Path ("/foo" ), client = client_mock
70+ image_name ,
71+ pathlib .Path ("/foo" ),
72+ client = client_mock if pass_client else None ,
6873 )
6974 assert image_mock == runner .image
7075
You can’t perform that action at this time.
0 commit comments