Skip to content
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
7 changes: 7 additions & 0 deletions go/pkg/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ func CopyToTempDir(localPath string, includePath string) (tempDir string, err er
// then copy the ones that match the includePath.
// TODO(andreas): only scan files in the includePath
filesToCopy, err := getListOfFilesToPut(localPath, tempDir)
if err != nil {
return "", err
}
count := 0
for _, file := range filesToCopy {

Expand Down Expand Up @@ -424,6 +427,10 @@ func CopyToTempDir(localPath string, includePath string) (tempDir string, err er
count += 1
}

if count == 0 {
return "", fmt.Errorf("No files matched '%s' in %s", includePath, localPath)
}

console.Debug("Copied %d files to temporary directory (took %.3f seconds)", count, time.Since(start).Seconds())

return tempDir, err
Expand Down
4 changes: 4 additions & 0 deletions go/pkg/repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,8 @@ func TestCopyToTempDir(t *testing.T) {
contents, err = ioutil.ReadFile(path.Join(tempDir, "my/folder/bar"))
require.NoError(t, err)
require.Equal(t, "bar", string(contents))

// with missing file
_, err = CopyToTempDir(dir, "not-existing")
require.Error(t, err)
}
3 changes: 3 additions & 0 deletions python/tests/test_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ def test_create_project_options(
with open("keepsake.yaml", "w") as f:
f.write("repository: file://.keepsake/")

with open("foo.txt", "w") as f:
f.write("hello world")

project = Project(repository=repo, directory=directory)

if exception:
Expand Down