Skip to content

Commit

Permalink
test: improve cov
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye committed Sep 2, 2023
1 parent e0ae8a6 commit 70b4a93
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/unit/helpers/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ def test_convert_path_not_supports_long_path_2(self):
mock_supports_long_paths.assert_called_once()
mock_win_prepare_path.assert_called_with(path_250_noprefix)

@pytest.mark.parametrize("version", [(-1), (1)])
@mock.patch("dbterd.helpers.file.open_json")
def test_read_manifest_error(self, mock_open_json):
def test_read_manifest_error(self, mock_open_json, version):
mock_open_json.return_value = dict({"data": "dummy"})
with pytest.raises(ValueError):
file.read_manifest(path="path/to/manifest")
file.read_manifest(path="path/to/manifest", version=version)
mock_open_json.assert_called_with("path/to/manifest/manifest.json")

@pytest.mark.parametrize("version", [(-1), (1)])
@mock.patch("dbterd.helpers.file.open_json")
def test_read_catalog_error(self, mock_open_json):
def test_read_catalog_error(self, mock_open_json, version):
mock_open_json.return_value = dict({"data": "dummy"})
with pytest.raises(ValueError):
file.read_catalog(path="path/to/catalog")
file.read_catalog(path="path/to/catalog", version=version)
mock_open_json.assert_called_with("path/to/catalog/catalog.json")

0 comments on commit 70b4a93

Please sign in to comment.