Allow for pygit2 enums not available, early version of pygit2

This commit is contained in:
David Murphy 2025-01-29 10:44:37 -07:00 committed by Daniel Wozniak
parent 41c3d0974c
commit 03df109113

View file

@ -24,7 +24,13 @@ if HAS_PYGIT2:
import pygit2
## DGM
from pygit2.enums import ObjectType
try:
from pygit2.enums import ObjectType
HAS_PYGIT2_ENUMS = True
except AttributeError:
HAS_PYGIT2_ENUMS = False
@pytest.fixture
@ -153,9 +159,14 @@ def _prepare_remote_repository_pygit2(tmp_path):
## DGM repository.create_tag(
## DGM "annotated_tag", commit, pygit2.GIT_OBJ_COMMIT, signature, "some message"
## DGM )
repository.create_tag(
"annotated_tag", commit, ObjectType.COMMIT, signature, "some message"
)
if HAS_PYGIT2_ENUMS:
repository.create_tag(
"annotated_tag", commit, ObjectType.COMMIT, signature, "some message"
)
else:
repository.create_tag(
"annotated_tag", commit, pygit2.GIT_OBJ_COMMIT, signature, "some message"
)
return remote