Skip to content

Commit f5a60d8

Browse files
authored
Max/write file 2 (#25)
* Write_file accepts file argument * Remote prints * Avoid file delete * Make sure we don't delete user's file
1 parent c9ed25c commit f5a60d8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doltcli/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,14 @@ def _import_helper(
221221
fname = tempfile.mktemp(suffix=".csv")
222222
import_flags = IMPORT_MODES_TO_FLAGS[import_mode]
223223
try:
224-
fname = write_import_file(fname)
224+
import_file = write_import_file(fname)
225225
args = ["table", "import", table] + import_flags
226226
if primary_key:
227227
args += ["--pk={}".format(",".join(primary_key))]
228228
if do_continue is True:
229229
args += ["--continue"]
230230

231-
dolt.execute(args + [fname])
231+
dolt.execute(args + [import_file])
232232

233233
if commit:
234234
msg = commit_message or f"Committing write to table {table} in {import_mode} mode"

tests/test_write.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24

35
from doltcli import (
@@ -100,6 +102,7 @@ def test_write_file(init_empty_test_repo, tmp_path):
100102
primary_key=["id"],
101103
do_continue=True,
102104
)
105+
assert os.path.exists(tmp_path)
103106
actual = read_rows(dolt, "characters")
104107
compare_rows_helper(TEST_ROWS[:2], actual)
105108

0 commit comments

Comments
 (0)