Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nosarthur committed Jul 24, 2023
1 parent 7540678 commit 2e6fba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion gita/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ def has_stashed(flags: List[str], path) -> bool:
"""
# FIXME: this doesn't work for repos like worktrees, bare, etc
p = Path(path) / ".git" / "logs" / "refs" / "stash"
return p.is_file()
got = False
try:
got = p.is_file()
except Exception:
pass
return got


def get_commit_msg(prop: Dict[str, str]) -> str:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_ls(self, monkeypatch, capfd):
@patch("gita.info.get_head", return_value="master")
@patch(
"gita.info._get_repo_status",
return_value=("dirty", "staged", "untracked", "diverged"),
return_value=("dirty", "staged", "untracked", "", "diverged"),
)
@patch("gita.info.get_commit_msg", return_value="msg")
@patch("gita.info.get_commit_time", return_value="")
Expand Down

0 comments on commit 2e6fba3

Please sign in to comment.