Skip to content

Commit 2524e95

Browse files
committed
feat: add network marker to tests requiring network access
1 parent 9689fb2 commit 2524e95

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ testpaths = "test" # Space separated list of paths from root e.g test tests doc
7474
# -ra # test summary: list all non-passing (fail, error, skip, xfail, xpass)
7575
# --ignore-glob=**/gitdb/* # ignore glob paths
7676
# filterwarnings ignore::WarningType # ignores those warnings
77+
markers = [
78+
"net: tests requiring network access",
79+
]
7780

7881
[tool.mypy]
7982
files = ["git/", "test/test_typing.py", "test/test_remote_progress.py"]

‎test/test_base.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from gitdb import OInfo
1414

15+
import pytest
16+
1517
from git import Repo
1618
from git.objects import Blob, Commit, TagObject, Tree
1719
import git.objects.base as base
@@ -122,6 +124,7 @@ def test_with_rw_repo(self, rw_repo: Repo):
122124
assert osp.isdir(osp.join(rw_repo.working_tree_dir, "lib"))
123125
assert osp.isdir(rw_repo.working_dir)
124126

127+
@pytest.mark.net
125128
@skipIf(sys.platform == "win32", "FIXME: Freezes! sometimes...")
126129
@with_rw_and_rw_remote_repo("0.1.6")
127130
def test_with_rw_remote_and_rw_repo(self, rw_repo, rw_remote_repo):

‎test/test_remote.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
441441
TagReference.delete(rw_repo, new_tag, other_tag)
442442
remote.push(":%s" % other_tag.path, kill_after_timeout=10.0)
443443

444+
@pytest.mark.net
444445
@skipIf(sys.platform == "win32", "FIXME: Freezes!")
445446
@with_rw_and_rw_remote_repo("0.1.6")
446447
def test_base(self, rw_repo, remote_repo):
@@ -1031,6 +1032,7 @@ def test_ls_remote_unsafe_options_allowed(self, rw_repo):
10311032
with self.assertRaises(GitCommandError):
10321033
rw_repo.git.ls_remote(".", **unsafe_option, allow_unsafe_options=True)
10331034

1035+
@pytest.mark.net
10341036
@with_rw_and_rw_remote_repo("0.1.6")
10351037
def test_fetch_unsafe_branch_name(self, rw_repo, remote_repo):
10361038
# Create branch with a name containing a NBSP

0 commit comments

Comments
 (0)