Skip to content

Commit 1487d5b

Browse files
finalize error handling for git file listing
1 parent 81d784a commit 1487d5b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/setuptools_scm/file_finder_git.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def _git_ls_files_and_dirs(toplevel):
5050
except Exception:
5151
if proc.wait() != 0:
5252
log.exception("listing git files failed - pretending there aren't any")
53+
return (), ()
5354

5455

5556
def git_find_files(path=""):

testing/test_git.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ def test_parse_describe_output(given, tag, number, node, dirty):
3030

3131

3232
@pytest.mark.issue("https://github.com/pypa/setuptools_scm/issues/298")
33-
def test_file_finder_no_history(wd):
34-
with pytest.warns(Warning, match="can't list files without commits"):
35-
file_list = git_find_files(str(wd.cwd))
36-
assert file_list == []
33+
def test_file_finder_no_history(wd, caplog):
34+
file_list = git_find_files(str(wd.cwd))
35+
assert file_list == []
36+
37+
assert "listing git files failed - pretending there aren't any" in caplog.text
3738

3839

3940
@pytest.mark.issue("https://github.com/pypa/setuptools_scm/issues/281")

0 commit comments

Comments
 (0)