def test_parse_no_worktree(tmpdir): ret = parse(str(tmpdir)) assert ret is None
def parse(root, config): try: return parse_pkginfo(root, config) except OSError: return git.parse(root, config=config) or hg.parse(root, config=config)
def test_hg_gone(wd, monkeypatch): monkeypatch.setenv("PATH", str(wd.cwd / "not-existing")) with pytest.raises(EnvironmentError, match="'hg' was not found"): parse(str(wd.cwd))