Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed dbfs.create to mkdirs for CLI #53

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def onboard(self, cmd: OnboardCommand):
"""Perform the onboarding process."""
self.update_ws_onboarding_paths(cmd)
if not self._ws.dbfs.exists(cmd.dbfs_path + "/dltmeta_conf/"):
self._ws.dbfs.create(path=cmd.dbfs_path + "/dltmeta_conf/", overwrite=True)
self._ws.dbfs.mkdirs(f"{cmd.dbfs_path}/dltmeta_conf/")
ob_file = open(cmd.onboarding_file_path, "rb")
onboarding_filename = os.path.basename(cmd.onboarding_file_path)
self._ws.dbfs.upload(cmd.dbfs_path + f"/dltmeta_conf/{onboarding_filename}", ob_file, overwrite=True)
Expand Down
7 changes: 2 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_onboard(self, mock_workspace_client):
mock_workspace_client.dbfs = mock_dbfs
mock_workspace_client.jobs = mock_jobs
mock_workspace_client.dbfs.exists.return_value = False
mock_workspace_client.dbfs.create.return_value = None
mock_workspace_client.dbfs.mkdirs.return_value = None
mock_workspace_client.dbfs.upload.return_value = None
mock_workspace_client.dbfs.copy.return_value = None
mock_workspace_client.jobs.create.return_value = MagicMock(job_id="job_id")
Expand All @@ -59,10 +59,7 @@ def test_onboard(self, mock_workspace_client):
dltmeta.onboard(self.onboard_cmd)

mock_workspace_client.dbfs.exists.assert_called_once_with('/dbfs/dltmeta_conf/')
mock_workspace_client.dbfs.create.assert_called_once_with(
path="/dbfs/dltmeta_conf/",
overwrite=True
)
mock_workspace_client.dbfs.mkdirs.assert_called_once_with("/dbfs/dltmeta_conf/")
mock_workspace_client.dbfs.upload.assert_called_once()
print(mock_workspace_client.dbfs.copy.call_args_list)
mock_workspace_client.dbfs.copy.assert_called_once_with(
Expand Down
Loading