From 611a3b3462a1acb6bc3ca0d9bd3eff7bf6154131 Mon Sep 17 00:00:00 2001 From: Iliyas Jorio Date: Fri, 29 Dec 2023 22:53:34 +0100 Subject: [PATCH] Remove individual enum classes from root namespace --- pygit2/__init__.py | 47 ++++------------------------------ test/conftest.py | 8 +++--- test/test_apply_diff.py | 6 ++--- test/test_blame.py | 3 ++- test/test_blob.py | 2 +- test/test_branch.py | 2 +- test/test_branch_empty.py | 2 +- test/test_cherrypick.py | 9 ++++--- test/test_commit.py | 3 ++- test/test_commit_gpg.py | 3 ++- test/test_credentials.py | 3 ++- test/test_describe.py | 4 +-- test/test_diff.py | 2 +- test/test_diff_binary.py | 8 +++--- test/test_filter.py | 2 +- test/test_index.py | 4 +-- test/test_merge.py | 3 +-- test/test_object.py | 3 ++- test/test_odb.py | 2 +- test/test_odb_backend.py | 5 ++-- test/test_options.py | 5 ++-- test/test_refs.py | 5 ++-- test/test_remote_prune.py | 10 +++++--- test/test_repository.py | 18 +++++++++---- test/test_repository_bare.py | 7 +++-- test/test_repository_custom.py | 5 ++-- test/test_revparse.py | 3 ++- test/test_revwalk.py | 2 +- test/test_status.py | 6 +++-- test/test_submodule.py | 2 +- test/test_tag.py | 5 ++-- test/test_tree.py | 4 +-- test/utils.py | 2 +- 33 files changed, 89 insertions(+), 106 deletions(-) diff --git a/pygit2/__init__.py b/pygit2/__init__.py index 9aa411cf..3e28caaa 100644 --- a/pygit2/__init__.py +++ b/pygit2/__init__.py @@ -32,6 +32,7 @@ from ._pygit2 import * # High level API +from . import enums from ._build import __version__ from .blame import Blame, BlameHunk from .blob import BlobIO @@ -39,44 +40,6 @@ from .callbacks import git_clone_options, git_fetch_options, get_credentials from .config import Config from .credentials import * -from .enums import ( - AttrCheck, - ApplyLocation, - BlameFlag, - BlobFilter, - BranchType, - CheckoutNotify, - CheckoutStrategy, - ConfigLevel, - CredentialType, - DeltaStatus, - DescribeStrategy, - DiffFlag, - DiffOption, - DiffStatsFormat, - Feature, - FetchPrune, - FileMode, - FilterFlag, - FilterMode, - ObjectType, - Option, - MergeAnalysis, - MergePreference, - ReferenceFilter, - ReferenceType, - RepositoryInitFlag, - RepositoryInitMode, - RepositoryOpenFlag, - RepositoryState, - ResetMode, - RevSpecFlag, - StashApplyProgress, - FileStatus, - SubmoduleIgnore, - SubmoduleStatus, - SortMode, -) from .errors import check_error, Passthrough from .ffi import ffi, C from .filter import Filter @@ -91,7 +54,7 @@ # Features -features = Feature(C.git_libgit2_features()) +features = enums.Feature(C.git_libgit2_features()) # libgit version tuple LIBGIT2_VER = (LIBGIT2_VER_MAJOR, LIBGIT2_VER_MINOR, LIBGIT2_VER_REVISION) @@ -100,8 +63,8 @@ def init_repository( path: typing.Union[str, bytes, PathLike, None], bare: bool = False, - flags: RepositoryInitFlag = RepositoryInitFlag.MKPATH, - mode: typing.Union[int, RepositoryInitMode] = RepositoryInitMode.SHARED_UMASK, + flags: enums.RepositoryInitFlag = enums.RepositoryInitFlag.MKPATH, + mode: typing.Union[int, enums.RepositoryInitMode] = enums.RepositoryInitMode.SHARED_UMASK, workdir_path: typing.Optional[str] = None, description: typing.Optional[str] = None, template_path: typing.Optional[str] = None, @@ -136,7 +99,7 @@ def init_repository( raise TypeError('Expected string type for path, found None.') if bare: - flags |= RepositoryInitFlag.BARE + flags |= enums.RepositoryInitFlag.BARE # Options options = ffi.new('git_repository_init_options *') diff --git a/test/conftest.py b/test/conftest.py index 8758a645..4f2a1ab2 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -10,15 +10,15 @@ def global_git_config(): # Do not use global config for better test reproducibility. # https://github.com/libgit2/pygit2/issues/989 - levels = [pygit2.ConfigLevel.GLOBAL, - pygit2.ConfigLevel.XDG, - pygit2.ConfigLevel.SYSTEM] + levels = [pygit2.enums.ConfigLevel.GLOBAL, + pygit2.enums.ConfigLevel.XDG, + pygit2.enums.ConfigLevel.SYSTEM] for level in levels: pygit2.settings.search_path[level] = "" # Fix tests running in AppVeyor if platform.system() == 'Windows': - pygit2.option(pygit2.Option.SET_OWNER_VALIDATION, 0) + pygit2.option(pygit2.enums.Option.SET_OWNER_VALIDATION, 0) @pytest.fixture diff --git a/test/test_apply_diff.py b/test/test_apply_diff.py index a2d92991..6e7a8d76 100644 --- a/test/test_apply_diff.py +++ b/test/test_apply_diff.py @@ -24,14 +24,12 @@ # Boston, MA 02110-1301, USA. import pygit2 +from pygit2.enums import ApplyLocation, CheckoutStrategy, FileStatus import pytest import os from pathlib import Path -from pygit2 import ApplyLocation -from pygit2 import FileStatus - def read_content(testrepo): with (Path(testrepo.workdir) / 'hello.txt').open('rb') as f: @@ -57,7 +55,7 @@ def patch_diff(testrepo, new_content): patch = testrepo.diff().patch # Rollback all changes - testrepo.checkout('HEAD', strategy=pygit2.CheckoutStrategy.FORCE) + testrepo.checkout('HEAD', strategy=CheckoutStrategy.FORCE) # Return the diff return pygit2.Diff.parse_diff(patch) diff --git a/test/test_blame.py b/test/test_blame.py index b700403c..9df504fb 100644 --- a/test/test_blame.py +++ b/test/test_blame.py @@ -27,7 +27,8 @@ import pytest -from pygit2 import Signature, Oid, BlameFlag +from pygit2 import Signature, Oid +from pygit2.enums import BlameFlag PATH = 'hello.txt' diff --git a/test/test_blob.py b/test/test_blob.py index 710a9ce1..064d0b30 100644 --- a/test/test_blob.py +++ b/test/test_blob.py @@ -33,7 +33,7 @@ import pytest import pygit2 -from pygit2 import ObjectType +from pygit2.enums import ObjectType from . import utils diff --git a/test/test_branch.py b/test/test_branch.py index 1600b1a9..f24dd87e 100644 --- a/test/test_branch.py +++ b/test/test_branch.py @@ -28,7 +28,7 @@ import pygit2 import pytest import os -from pygit2 import BranchType +from pygit2.enums import BranchType LAST_COMMIT = '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98' diff --git a/test/test_branch_empty.py b/test/test_branch_empty.py index e92b2ce6..06d86d55 100644 --- a/test/test_branch_empty.py +++ b/test/test_branch_empty.py @@ -25,7 +25,7 @@ import pygit2 import pytest -from pygit2 import BranchType +from pygit2.enums import BranchType ORIGIN_MASTER_COMMIT = '784855caf26449a1914d2cf62d12b9374d76ae78' diff --git a/test/test_cherrypick.py b/test/test_cherrypick.py index 1147095c..409431a6 100644 --- a/test/test_cherrypick.py +++ b/test/test_cherrypick.py @@ -26,9 +26,10 @@ """Tests for merging and information about it.""" from pathlib import Path +import pytest import pygit2 -import pytest +from pygit2.enums import RepositoryState def test_cherrypick_none(mergerepo): @@ -48,10 +49,10 @@ def test_cherrypick_already_something_in_index(mergerepo): def test_cherrypick_remove_conflicts(mergerepo): - assert mergerepo.state() == pygit2.RepositoryState.NONE + assert mergerepo.state() == RepositoryState.NONE other_branch_tip = '1b2bae55ac95a4be3f8983b86cd579226d0eb247' mergerepo.cherrypick(other_branch_tip) - assert mergerepo.state() == pygit2.RepositoryState.CHERRYPICK + assert mergerepo.state() == RepositoryState.CHERRYPICK idx = mergerepo.index conflicts = idx.conflicts assert conflicts is not None @@ -60,4 +61,4 @@ def test_cherrypick_remove_conflicts(mergerepo): with pytest.raises(KeyError): conflicts.__getitem__('.gitignore') assert idx.conflicts is None mergerepo.state_cleanup() - assert mergerepo.state() == pygit2.RepositoryState.NONE + assert mergerepo.state() == RepositoryState.NONE diff --git a/test/test_commit.py b/test/test_commit.py index dd3fef67..f0717d38 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -29,7 +29,8 @@ import pytest -from pygit2 import Signature, Oid, GitError, ObjectType +from pygit2 import Signature, Oid, GitError +from pygit2.enums import ObjectType from . import utils diff --git a/test/test_commit_gpg.py b/test/test_commit_gpg.py index 0d3ef778..bfea09e1 100644 --- a/test/test_commit_gpg.py +++ b/test/test_commit_gpg.py @@ -23,7 +23,8 @@ # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -from pygit2 import ObjectType, Oid, Signature +from pygit2 import Oid, Signature +from pygit2.enums import ObjectType content = """\ tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 diff --git a/test/test_credentials.py b/test/test_credentials.py index 18088d09..8d40fdd2 100644 --- a/test/test_credentials.py +++ b/test/test_credentials.py @@ -30,7 +30,8 @@ import pytest import pygit2 -from pygit2 import CredentialType, Username, UserPass, Keypair, KeypairFromAgent, KeypairFromMemory +from pygit2 import Username, UserPass, Keypair, KeypairFromAgent, KeypairFromMemory +from pygit2.enums import CredentialType from . import utils diff --git a/test/test_describe.py b/test/test_describe.py index e76259f0..21f537a1 100644 --- a/test/test_describe.py +++ b/test/test_describe.py @@ -27,7 +27,7 @@ import pytest -from pygit2 import DescribeStrategy +from pygit2.enums import DescribeStrategy, ObjectType import pygit2 @@ -35,7 +35,7 @@ def add_tag(repo, name, target): message = 'Example tag.\n' tagger = pygit2.Signature('John Doe', 'jdoe@example.com', 12347, 0) - sha = repo.create_tag(name, target, pygit2.ObjectType.COMMIT, tagger, message) + sha = repo.create_tag(name, target, ObjectType.COMMIT, tagger, message) return sha diff --git a/test/test_diff.py b/test/test_diff.py index 6f1b767b..8ae99463 100644 --- a/test/test_diff.py +++ b/test/test_diff.py @@ -31,7 +31,7 @@ import pytest import pygit2 -from pygit2 import DeltaStatus, DiffOption, DiffStatsFormat +from pygit2.enums import DeltaStatus, DiffOption, DiffStatsFormat COMMIT_SHA1_1 = '5fe808e8953c12735680c257f56600cb0de44b10' diff --git a/test/test_diff_binary.py b/test/test_diff_binary.py index 0444246f..e3285992 100644 --- a/test/test_diff_binary.py +++ b/test/test_diff_binary.py @@ -23,9 +23,11 @@ # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -import pygit2 import pytest +import pygit2 +from pygit2.enums import DiffOption + from . import utils @@ -54,9 +56,9 @@ def repo(tmp_path): def test_binary_diff(repo): diff = repo.diff('HEAD', 'HEAD^') assert PATCH_BINARY == diff.patch - diff = repo.diff('HEAD', 'HEAD^', flags=pygit2.DiffOption.SHOW_BINARY) + diff = repo.diff('HEAD', 'HEAD^', flags=DiffOption.SHOW_BINARY) assert PATCH_BINARY_SHOW == diff.patch diff = repo.diff(b'HEAD', b'HEAD^') assert PATCH_BINARY == diff.patch - diff = repo.diff(b'HEAD', b'HEAD^', flags=pygit2.DiffOption.SHOW_BINARY) + diff = repo.diff(b'HEAD', b'HEAD^', flags=DiffOption.SHOW_BINARY) assert PATCH_BINARY_SHOW == diff.patch diff --git a/test/test_filter.py b/test/test_filter.py index 3e1ee523..80b80c76 100644 --- a/test/test_filter.py +++ b/test/test_filter.py @@ -3,7 +3,7 @@ import pytest import pygit2 -from pygit2 import BlobFilter +from pygit2.enums import BlobFilter from pygit2.errors import Passthrough diff --git a/test/test_index.py b/test/test_index.py index 28c46dc6..a398b374 100644 --- a/test/test_index.py +++ b/test/test_index.py @@ -31,7 +31,7 @@ import pygit2 from pygit2 import Repository, Index, Oid -from pygit2 import FileMode +from pygit2.enums import FileMode from . import utils @@ -214,7 +214,7 @@ def test_change_attributes(testrepo): assert FileMode.BLOB_EXECUTABLE == entry.mode def test_write_tree_to(testrepo, tmp_path): - pygit2.option(pygit2.Option.ENABLE_STRICT_OBJECT_CREATION, False) + pygit2.option(pygit2.enums.Option.ENABLE_STRICT_OBJECT_CREATION, False) with utils.TemporaryRepository('emptyrepo.zip', tmp_path) as path: nrepo = Repository(path) id = testrepo.index.write_tree(nrepo) diff --git a/test/test_merge.py b/test/test_merge.py index 9321f088..32225e18 100644 --- a/test/test_merge.py +++ b/test/test_merge.py @@ -29,9 +29,8 @@ import pytest -from pygit2 import MergeAnalysis -from pygit2 import FileStatus import pygit2 +from pygit2.enums import FileStatus, MergeAnalysis @pytest.mark.parametrize("id", [None, 42]) diff --git a/test/test_object.py b/test/test_object.py index c87cca0c..ce41e94f 100644 --- a/test/test_object.py +++ b/test/test_object.py @@ -27,7 +27,8 @@ import pytest -from pygit2 import ObjectType, Tree, Tag +from pygit2 import Tree, Tag +from pygit2.enums import ObjectType BLOB_SHA = 'a520c24d85fbfc815d385957eed41406ca5a860b' diff --git a/test/test_odb.py b/test/test_odb.py index 7bbb03ca..f7310ddf 100644 --- a/test/test_odb.py +++ b/test/test_odb.py @@ -33,7 +33,7 @@ # pygit2 from pygit2 import Odb, Oid -from pygit2 import ObjectType +from pygit2.enums import ObjectType from . import utils diff --git a/test/test_odb_backend.py b/test/test_odb_backend.py index 52dd0473..ead37b1b 100644 --- a/test/test_odb_backend.py +++ b/test/test_odb_backend.py @@ -33,6 +33,7 @@ # pygit2 import pygit2 +from pygit2.enums import ObjectType from . import utils @@ -113,12 +114,12 @@ def test_read(proxy): ab = proxy.read(BLOB_OID) a = proxy.read(BLOB_HEX) assert ab == a - assert (pygit2.ObjectType.BLOB, b'a contents\n') == a + assert (ObjectType.BLOB, b'a contents\n') == a def test_read_prefix(proxy): a_hex_prefix = BLOB_HEX[:4] a3 = proxy.read_prefix(a_hex_prefix) - assert (pygit2.ObjectType.BLOB, b'a contents\n', BLOB_OID) == a3 + assert (ObjectType.BLOB, b'a contents\n', BLOB_OID) == a3 def test_exists(proxy): with pytest.raises(TypeError): diff --git a/test/test_options.py b/test/test_options.py index 7889277b..ce30fc14 100644 --- a/test/test_options.py +++ b/test/test_options.py @@ -24,7 +24,8 @@ # Boston, MA 02110-1301, USA. import pygit2 -from pygit2 import option, ConfigLevel, ObjectType, Option +from pygit2 import option +from pygit2.enums import ConfigLevel, ObjectType, Option def __option(getter, setter, value): @@ -61,7 +62,7 @@ def test_mwindow_mapped_limit_300(): def test_cache_object_limit(): new_limit = 2 * 1024 - option(Option.SET_CACHE_OBJECT_LIMIT, GIT_OBJ_BLOB, new_limit) + option(Option.SET_CACHE_OBJECT_LIMIT, ObjectType.BLOB, new_limit) def test_cache_object_limit_proxy(): new_limit = 4 * 1024 diff --git a/test/test_refs.py b/test/test_refs.py index b31d92c3..01569904 100644 --- a/test/test_refs.py +++ b/test/test_refs.py @@ -29,10 +29,9 @@ import pytest -from pygit2 import ReferenceType -from pygit2 import Signature -from pygit2 import Commit, Tree, reference_is_valid_name +from pygit2 import Commit, Signature, Tree, reference_is_valid_name from pygit2 import AlreadyExistsError, GitError, InvalidSpecError +from pygit2.enums import ReferenceType LAST_COMMIT = '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98' diff --git a/test/test_remote_prune.py b/test/test_remote_prune.py index 8f788c4b..6a2dc3e8 100644 --- a/test/test_remote_prune.py +++ b/test/test_remote_prune.py @@ -23,9 +23,11 @@ # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -import pygit2 import pytest +import pygit2 +from pygit2.enums import FetchPrune + @pytest.fixture def clonerepo(testrepo, tmp_path): @@ -42,11 +44,11 @@ def test_fetch_remote_default(clonerepo): assert 'origin/i18n' in clonerepo.branches def test_fetch_remote_prune(clonerepo): - clonerepo.remotes[0].fetch(prune=pygit2.FetchPrune.PRUNE) + clonerepo.remotes[0].fetch(prune=FetchPrune.PRUNE) assert 'origin/i18n' not in clonerepo.branches def test_fetch_no_prune(clonerepo): - clonerepo.remotes[0].fetch(prune=pygit2.FetchPrune.NO_PRUNE) + clonerepo.remotes[0].fetch(prune=FetchPrune.NO_PRUNE) assert 'origin/i18n' in clonerepo.branches def test_remote_prune(clonerepo): @@ -59,7 +61,7 @@ def update_tips(self, name, old, new): remote = clonerepo.remotes['origin'] # We do a fetch in order to establish the connection to the remote. # Prune operation requires an active connection. - remote.fetch(prune=pygit2.FetchPrune.NO_PRUNE) + remote.fetch(prune=FetchPrune.NO_PRUNE) assert 'origin/i18n' in clonerepo.branches remote.prune(callbacks) assert pruned == ['refs/remotes/origin/i18n'] diff --git a/test/test_repository.py b/test/test_repository.py index 5159d161..bdeb1b1a 100644 --- a/test/test_repository.py +++ b/test/test_repository.py @@ -34,7 +34,15 @@ import pygit2 from pygit2 import init_repository, clone_repository, discover_repository from pygit2 import Oid -from pygit2 import CheckoutNotify, CheckoutStrategy, FileStatus, ObjectType, ResetMode, StashApplyProgress +from pygit2.enums import ( + CheckoutNotify, + CheckoutStrategy, + FileStatus, + ObjectType, + RepositoryOpenFlag, + ResetMode, + StashApplyProgress, +) from . import utils @@ -768,20 +776,20 @@ def test_open_extended(tmp_path): assert repo.workdir == orig_repo.workdir with pytest.raises(pygit2.GitError): - repo = pygit2.Repository(subdir_path, pygit2.RepositoryOpenFlag.NO_SEARCH) + repo = pygit2.Repository(subdir_path, RepositoryOpenFlag.NO_SEARCH) # GIT_REPOSITORY_OPEN_NO_DOTGIT gitdir_path = path / '.git' with pytest.raises(pygit2.GitError): - repo = pygit2.Repository(path, pygit2.RepositoryOpenFlag.NO_DOTGIT) + repo = pygit2.Repository(path, RepositoryOpenFlag.NO_DOTGIT) - repo = pygit2.Repository(gitdir_path, pygit2.RepositoryOpenFlag.NO_DOTGIT) + repo = pygit2.Repository(gitdir_path, RepositoryOpenFlag.NO_DOTGIT) assert not repo.is_bare assert repo.path == orig_repo.path assert repo.workdir == orig_repo.workdir # GIT_REPOSITORY_OPEN_BARE - repo = pygit2.Repository(gitdir_path, pygit2.RepositoryOpenFlag.BARE) + repo = pygit2.Repository(gitdir_path, RepositoryOpenFlag.BARE) assert repo.is_bare assert repo.path == orig_repo.path assert not repo.workdir diff --git a/test/test_repository_bare.py b/test/test_repository_bare.py index 34375934..7162de1f 100644 --- a/test/test_repository_bare.py +++ b/test/test_repository_bare.py @@ -29,11 +29,10 @@ from pathlib import Path import sys import tempfile - -import pygit2 import pytest -from pygit2 import ObjectType +import pygit2 +from pygit2.enums import FileMode, ObjectType from . import utils @@ -186,7 +185,7 @@ def test_conflicts_in_bare_repository(barerepo): def create_conflict_file(repo, branch, content): oid = repo.create_blob(content.encode('utf-8')) tb = repo.TreeBuilder() - tb.insert('conflict', oid, pygit2.FileMode.BLOB) + tb.insert('conflict', oid, FileMode.BLOB) tree = tb.write() sig = pygit2.Signature('Author', 'author@example.com') diff --git a/test/test_repository_custom.py b/test/test_repository_custom.py index 49ab7e97..3ce18eed 100644 --- a/test/test_repository_custom.py +++ b/test/test_repository_custom.py @@ -24,9 +24,10 @@ # Boston, MA 02110-1301, USA. from pathlib import Path +import pytest import pygit2 -import pytest +from pygit2.enums import ObjectType @pytest.fixture @@ -54,4 +55,4 @@ def test_references(repo): def test_objects(repo): a = repo.read('323fae03f4606ea9991df8befbb2fca795e648fa') - assert (pygit2.ObjectType.BLOB, b'foobar\n') == a + assert (ObjectType.BLOB, b'foobar\n') == a diff --git a/test/test_revparse.py b/test/test_revparse.py index 67c8ed7a..653e2e5f 100644 --- a/test/test_revparse.py +++ b/test/test_revparse.py @@ -25,7 +25,8 @@ """Tests for revision parsing.""" -from pygit2 import RevSpecFlag, InvalidSpecError +from pygit2 import InvalidSpecError +from pygit2.enums import RevSpecFlag from pytest import raises HEAD_SHA = '2be5719152d4f82c7302b1c0932d8e5f0a4a0e98' diff --git a/test/test_revwalk.py b/test/test_revwalk.py index 29d489dc..d979abb4 100644 --- a/test/test_revwalk.py +++ b/test/test_revwalk.py @@ -25,7 +25,7 @@ """Tests for revision walk.""" -from pygit2 import SortMode +from pygit2.enums import SortMode # In the order given by git log diff --git a/test/test_status.py b/test/test_status.py index 337641ae..96a1b610 100644 --- a/test/test_status.py +++ b/test/test_status.py @@ -22,9 +22,11 @@ # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -import pygit2 + import pytest -from pygit2 import FileStatus + +import pygit2 +from pygit2.enums import FileStatus def test_status(dirtyrepo): diff --git a/test/test_submodule.py b/test/test_submodule.py index 17c75d26..a6e0e1fb 100644 --- a/test/test_submodule.py +++ b/test/test_submodule.py @@ -31,7 +31,7 @@ import pytest from . import utils -from pygit2 import SubmoduleIgnore as SI, SubmoduleStatus as SS +from pygit2.enums import SubmoduleIgnore as SI, SubmoduleStatus as SS SUBM_NAME = 'TestGitRepository' diff --git a/test/test_tag.py b/test/test_tag.py index 639ed0da..6ddfd037 100644 --- a/test/test_tag.py +++ b/test/test_tag.py @@ -25,9 +25,10 @@ """Tests for Tag objects.""" -import pygit2 import pytest -from pygit2 import ObjectType + +import pygit2 +from pygit2.enums import ObjectType TAG_SHA = '3d2962987c695a29f1f80b6c3aa4ec046ef44369' diff --git a/test/test_tree.py b/test/test_tree.py index 7c46e6ff..24d6b60d 100644 --- a/test/test_tree.py +++ b/test/test_tree.py @@ -24,12 +24,12 @@ # Boston, MA 02110-1301, USA. import operator +import pytest import pygit2 -import pytest +from pygit2.enums import FileMode, ObjectType from . import utils -from pygit2 import FileMode, ObjectType TREE_SHA = '967fce8df97cc71722d3c2a5930ef3e6f1d27b12' diff --git a/test/utils.py b/test/utils.py index dbe8ba56..f0253506 100644 --- a/test/utils.py +++ b/test/utils.py @@ -61,7 +61,7 @@ reason='Requires proxy at port 8888') requires_ssh = pytest.mark.skipif( - pygit2.Feature.SSH not in pygit2.features, + pygit2.enums.Feature.SSH not in pygit2.features, reason='Requires SSH')