From 2524e95244db8f0446ee0a4c2ebccadddfa5117b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Wed, 4 Nov 2026 00:44:47 +0100 Subject: [PATCH] feat: add network marker to tests requiring network access --- pyproject.toml | 3 +++ test/test_base.py | 3 +++ test/test_remote.py | 2 ++ 3 files changed, 8 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 63645d9a9..89f23998d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,9 @@ testpaths = "test" # Space separated list of paths from root e.g test tests doc # -ra # test summary: list all non-passing (fail, error, skip, xfail, xpass) # --ignore-glob=**/gitdb/* # ignore glob paths # filterwarnings ignore::WarningType # ignores those warnings +markers = [ + "net: tests requiring network access", + ] [tool.mypy] files = ["git/", "test/test_typing.py", "test/test_remote_progress.py"] diff --git a/test/test_base.py b/test/test_base.py index 014f35429..4fddf0c47 100644 --- a/test/test_base.py +++ b/test/test_base.py @@ -12,6 +12,8 @@ from gitdb import OInfo +import pytest + from git import Repo from git.objects import Blob, Commit, TagObject, Tree import git.objects.base as base @@ -122,6 +124,7 @@ def test_with_rw_repo(self, rw_repo: Repo): assert osp.isdir(osp.join(rw_repo.working_tree_dir, "lib")) assert osp.isdir(rw_repo.working_dir) + @pytest.mark.net @skipIf(sys.platform == "win32", "FIXME: Freezes! sometimes...") @with_rw_and_rw_remote_repo("0.1.6") def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo): diff --git a/test/test_remote.py b/test/test_remote.py index f83cfc86f..5fc6f73bc 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -441,6 +441,7 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): TagReference.delete(rw_repo, new_tag, other_tag) remote.push(":%s" % other_tag.path, kill_after_timeout=10.0) + @pytest.mark.net @skipIf(sys.platform == "win32", "FIXME: Freezes!") @with_rw_and_rw_remote_repo("0.1.6") def test_base(self, rw_repo, remote_repo): @@ -1031,6 +1032,7 @@ def test_ls_remote_unsafe_options_allowed(self, rw_repo): with self.assertRaises(GitCommandError): rw_repo.git.ls_remote(".", **unsafe_option, allow_unsafe_options=True) + @pytest.mark.net @with_rw_and_rw_remote_repo("0.1.6") def test_fetch_unsafe_branch_name(self, rw_repo, remote_repo): # Create branch with a name containing a NBSP