feat: Add Python 3.7 Support and Restore Compatibility with Older Syntax (#181)

* Add Python 3.9 support by using ParamSpec from typing_extensions and removing match statements

* Add Python 3.7 support by reverting inline generics and removing walrus usage

* Update pyproject.toml
This commit is contained in:
Filip Christiansen 2025-02-17 02:36:57 -08:00 committed by GitHub
parent 9be28a4eef
commit 4397a45281
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 210 additions and 196 deletions

View file

@ -469,18 +469,17 @@ async def test_parse_repo_source_with_various_url_patterns(url, expected_branch,
When `_parse_repo_source` is called with remote branch fetching,
Then the correct branch/subpath should be set or None if unmatched.
"""
with (
patch("gitingest.repository_clone._run_git_command", new_callable=AsyncMock) as mock_run_git_command,
patch("gitingest.repository_clone.fetch_remote_branch_list", new_callable=AsyncMock) as mock_fetch_branches,
):
with patch("gitingest.repository_clone._run_git_command", new_callable=AsyncMock) as mock_run_git_command:
with patch(
"gitingest.repository_clone.fetch_remote_branch_list", new_callable=AsyncMock
) as mock_fetch_branches:
mock_run_git_command.return_value = (
b"refs/heads/feature/fix1\nrefs/heads/main\nrefs/heads/feature-branch\nrefs/heads/fix\n",
b"",
)
mock_fetch_branches.return_value = ["feature/fix1", "main", "feature-branch"]
mock_run_git_command.return_value = (
b"refs/heads/feature/fix1\nrefs/heads/main\nrefs/heads/feature-branch\nrefs/heads/fix\n",
b"",
)
mock_fetch_branches.return_value = ["feature/fix1", "main", "feature-branch"]
parsed_query = await _parse_repo_source(url)
parsed_query = await _parse_repo_source(url)
assert parsed_query.branch == expected_branch
assert parsed_query.subpath == expected_subpath
assert parsed_query.branch == expected_branch
assert parsed_query.subpath == expected_subpath