44Tests SDKBuildClient and CLIBuildClient implementations of the BuildClient interface.
55"""
66
7+ import os
78from unittest import TestCase
89from unittest .mock import Mock , patch
910
@@ -17,7 +18,7 @@ def setUp(self):
1718 self .mock_container_client = Mock ()
1819 self .client = SDKBuildClient (self .mock_container_client )
1920 self .base_build_args = {
20- "path" : "/ path/to/ context" ,
21+ "path" : os . path . join ( " path" , "to" , " context") ,
2122 "dockerfile" : "Dockerfile" ,
2223 "tag" : "image:latest" ,
2324 }
@@ -70,7 +71,7 @@ def setUp(self):
7071 self .finch_client = CLIBuildClient (engine_type = "finch" )
7172
7273 self .base_build_args = {
73- "path" : "/ path/to/ context" ,
74+ "path" : os . path . join ( " path" , "to" , " context") ,
7475 "dockerfile" : "Dockerfile" ,
7576 "tag" : "image:latest" ,
7677 }
@@ -110,7 +111,7 @@ def test_build_image_docker_command(self, mock_popen):
110111 "buildx" ,
111112 "build" ,
112113 "-f" ,
113- "/ path/to/ context/ Dockerfile" ,
114+ os . path . join ( " path" , "to" , " context" , " Dockerfile") ,
114115 "-t" ,
115116 "image:latest" ,
116117 "--platform" ,
@@ -120,7 +121,7 @@ def test_build_image_docker_command(self, mock_popen):
120121 "--target" ,
121122 "prod" ,
122123 "--rm" ,
123- "/ path/to/ context" ,
124+ os . path . join ( " path" , "to" , " context") ,
124125 ]
125126
126127 mock_popen .assert_called_once ()
@@ -141,11 +142,11 @@ def test_build_image_finch_command(self, mock_popen):
141142 "finch" ,
142143 "build" ,
143144 "-f" ,
144- "/ path/to/ context/ Dockerfile" ,
145+ os . path . join ( " path" , "to" , " context" , " Dockerfile") ,
145146 "-t" ,
146147 "image:latest" ,
147148 "--rm" ,
148- "/ path/to/ context" ,
149+ os . path . join ( " path" , "to" , " context") ,
149150 ]
150151
151152 mock_popen .assert_called_once ()
@@ -173,11 +174,11 @@ def test_build_image_streams_output_as_dicts(self, mock_popen):
173174 "finch" ,
174175 "build" ,
175176 "-f" ,
176- "/ path/to/ context/ Dockerfile" ,
177+ os . path . join ( " path" , "to" , " context" , " Dockerfile") ,
177178 "-t" ,
178179 "image:latest" ,
179180 "--rm" ,
180- "/ path/to/ context" ,
181+ os . path . join ( " path" , "to" , " context") ,
181182 ]
182183 actual_cmd = mock_popen .call_args [0 ][0 ]
183184 self .assertEqual (actual_cmd , expected_cmd )
0 commit comments