MCPcopy Create free account
hub / github.com/mkdocstrings/griffe / test_load_git_errors

Function test_load_git_errors

packages/griffelib/tests/test_git.py:86–99  ·  view source on GitHub ↗

Test that we get informative errors for various invalid inputs. Parameters: git_repo: temporary git repo

(git_repo: Path)

Source from the content-addressed store, hash-verified

84
85
86def test_load_git_errors(git_repo: Path) -> None:
87 """Test that we get informative errors for various invalid inputs.
88
89 Parameters:
90 git_repo: temporary git repo
91 """
92 with pytest.raises(OSError, match="Not a git repository"):
93 load_git(MODULE_NAME, ref="v0.2.0", repo="not-a-repo")
94
95 with pytest.raises(RuntimeError, match="Could not create git worktree"):
96 load_git(MODULE_NAME, ref="invalid-tag", repo=git_repo)
97
98 with pytest.raises(ImportError, match="ModuleNotFoundError: No module named 'not_a_real_module'"):
99 load_git("not_a_real_module", ref="v0.2.0", repo=git_repo)
100
101
102def test_git_failures(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 1

load_gitFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…