16
16
SUPPORT_LIB_NAME ,
17
17
SUPPORT_LIB_PKG ,
18
18
Python36LanguagePlugin as PythonLanguagePlugin ,
19
- StandardDistNotFoundError ,
20
19
validate_no ,
21
20
)
22
21
@@ -71,12 +70,6 @@ def test_validate_no(value, result):
71
70
assert validate_no (value ) is result
72
71
73
72
74
- def test__check_for_support_lib_sdist (tmp_path ):
75
- with pytest .raises (StandardDistNotFoundError ):
76
- PythonLanguagePlugin ._check_for_support_lib_sdist (tmp_path )
77
- # good path tested in generate
78
-
79
-
80
73
def test__remove_build_artifacts_file_found (tmp_path ):
81
74
deps_path = tmp_path / "build"
82
75
deps_path .mkdir ()
@@ -172,32 +165,28 @@ def test_package_pip(project):
172
165
173
166
def test__pip_build_executable_not_found (tmp_path ):
174
167
executable_name = str (uuid4 ())
175
- patch_sdist = patch .object (PythonLanguagePlugin , "_check_for_support_lib_sdist" )
176
168
patch_cmd = patch .object (
177
169
PythonLanguagePlugin , "_make_pip_command" , return_value = [executable_name ]
178
170
)
179
171
180
- with patch_sdist as mock_sdist , patch_cmd as mock_cmd :
172
+ with patch_cmd as mock_cmd :
181
173
with pytest .raises (DownstreamError ) as excinfo :
182
174
PythonLanguagePlugin ._pip_build (tmp_path )
183
175
184
- mock_sdist .assert_called_once_with (tmp_path )
185
176
mock_cmd .assert_called_once_with (tmp_path )
186
177
187
178
assert isinstance (excinfo .value .__cause__ , FileNotFoundError )
188
179
189
180
190
181
def test__pip_build_called_process_error (tmp_path ):
191
- patch_sdist = patch .object (PythonLanguagePlugin , "_check_for_support_lib_sdist" )
192
182
patch_cmd = patch .object (
193
183
PythonLanguagePlugin , "_make_pip_command" , return_value = ["false" ]
194
184
)
195
185
196
- with patch_sdist as mock_sdist , patch_cmd as mock_cmd :
186
+ with patch_cmd as mock_cmd :
197
187
with pytest .raises (DownstreamError ) as excinfo :
198
188
PythonLanguagePlugin ._pip_build (tmp_path )
199
189
200
- mock_sdist .assert_called_once_with (tmp_path )
201
190
mock_cmd .assert_called_once_with (tmp_path )
202
191
203
192
assert isinstance (excinfo .value .__cause__ , CalledProcessError )
@@ -228,15 +217,13 @@ def test__build_docker(plugin):
228
217
229
218
230
219
def test__docker_build_good_path (plugin , tmp_path ):
231
- patch_sdist = patch .object (PythonLanguagePlugin , "_check_for_support_lib_sdist" )
232
220
patch_from_env = patch ("rpdk.python.codegen.docker.from_env" , autospec = True )
233
221
234
- with patch_sdist as mock_sdist , patch_from_env as mock_from_env :
222
+ with patch_from_env as mock_from_env :
235
223
mock_run = mock_from_env .return_value .containers .run
236
224
mock_run .return_value = [b"output\n \n " ]
237
225
plugin ._docker_build (tmp_path )
238
226
239
- mock_sdist .assert_called_once_with (tmp_path )
240
227
mock_from_env .assert_called_once_with ()
241
228
mock_run .assert_called_once_with (
242
229
image = ANY ,
@@ -260,17 +247,15 @@ def test__docker_build_good_path(plugin, tmp_path):
260
247
],
261
248
)
262
249
def test__docker_build_bad_path (plugin , tmp_path , exception ):
263
- patch_sdist = patch .object (PythonLanguagePlugin , "_check_for_support_lib_sdist" )
264
250
patch_from_env = patch ("rpdk.python.codegen.docker.from_env" , autospec = True )
265
251
266
- with patch_sdist as mock_sdist , patch_from_env as mock_from_env :
252
+ with patch_from_env as mock_from_env :
267
253
mock_run = mock_from_env .return_value .containers .run
268
254
mock_run .side_effect = exception ()
269
255
270
256
with pytest .raises (DownstreamError ):
271
257
plugin ._docker_build (tmp_path )
272
258
273
- mock_sdist .assert_called_once_with (tmp_path )
274
259
mock_from_env .assert_called_once_with ()
275
260
mock_run .assert_called_once_with (
276
261
image = ANY ,
0 commit comments