Skip to content

Commit 7351d5d

Browse files
committed
Fix lint & unit test issues
1 parent f99846c commit 7351d5d

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/datacustomcode/deploy.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,13 @@ def get_data_transform_config(directory: str) -> DataTransformConfig:
267267
config = json.loads(f.read())
268268
return DataTransformConfig(**config)
269269
except FileNotFoundError as err:
270-
raise FileNotFoundError(
271-
f"config.json not found in {config_path}"
272-
) from err
270+
raise FileNotFoundError(f"config.json not found at {config_path}") from err
273271
except json.JSONDecodeError as err:
274-
raise ValueError(
275-
f"config.json in {config_path} is not valid JSON"
276-
) from err
272+
raise ValueError(f"config.json at {config_path} is not valid JSON") from err
277273
except pydantic.ValidationError as err:
278274
missing_fields = [str(err["loc"][0]) for err in err.errors()]
279275
raise ValueError(
280-
f"config.json in {config_path} is missing required "
276+
f"config.json at {config_path} is missing required "
281277
f"fields: {', '.join(missing_fields)}"
282278
) from err
283279

tests/test_deploy.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,21 @@ def test_verify_data_transform_config_missing(self, mock_exists):
249249
"""Test verifying data transform config file when it doesn't exist."""
250250
mock_exists.return_value = False
251251
with pytest.raises(
252-
FileNotFoundError, match="config.json not found in /test/dir/payload"
252+
FileNotFoundError,
253+
match="config.json not found at /test/dir/payload/config.json",
253254
):
254-
verify_data_transform_config("/test/dir")
255+
verify_data_transform_config("/test/dir/payload")
255256

256257
@patch("datacustomcode.deploy.os.path.exists")
257258
@patch("builtins.open", new_callable=mock_open, read_data='{"invalid": "json"')
258259
def test_verify_data_transform_config_invalid_json(self, mock_file, mock_exists):
259260
"""Test verifying data transform config with invalid JSON."""
260261
mock_exists.return_value = True
261262
with pytest.raises(
262-
ValueError, match="config.json in /test/dir/payload is not valid JSON"
263+
ValueError,
264+
match="config.json at /test/dir/payload/config.json is not valid JSON",
263265
):
264-
verify_data_transform_config("/test/dir")
266+
verify_data_transform_config("/test/dir/payload")
265267

266268
@patch("datacustomcode.deploy.os.path.exists")
267269
@patch("builtins.open", new_callable=mock_open, read_data='{"sdkVersion": "1.0.0"}')
@@ -270,10 +272,10 @@ def test_verify_data_transform_config_missing_fields(self, mock_file, mock_exist
270272
mock_exists.return_value = True
271273
with pytest.raises(
272274
ValueError,
273-
match="config.json in /test/dir/payload is missing required fields: "
274-
"entryPoint, dataspace, permissions",
275+
match="config.json at /test/dir/payload/config.json is missing "
276+
"required fields: entryPoint, dataspace, permissions",
275277
):
276-
verify_data_transform_config("/test/dir")
278+
verify_data_transform_config("/test/dir/payload")
277279

278280

279281
class TestCreateDataTransform:

0 commit comments

Comments
 (0)