Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a4d880

Browse filesBrowse files
committed
Improve test suite import grouping/sorting, __all__ placement
There is only one __all__ in the test suite, so this is mostly the change to imports, grouping and sorting them in a fully consistent style that is the same as the import style in the code under test.
1 parent f705fd6 commit 4a4d880
Copy full SHA for 4a4d880

27 files changed

+99
-95
lines changed

‎test/lib/helper.py

Copy file name to clipboardExpand all lines: test/lib/helper.py
+16-16Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6+
__all__ = [
7+
"fixture_path",
8+
"fixture",
9+
"StringProcessAdapter",
10+
"with_rw_directory",
11+
"with_rw_repo",
12+
"with_rw_and_rw_remote_repo",
13+
"TestBase",
14+
"VirtualEnvironment",
15+
"TestCase",
16+
"SkipTest",
17+
"skipIf",
18+
"GIT_REPO",
19+
"GIT_DAEMON_PORT",
20+
]
21+
622
import contextlib
723
from functools import wraps
824
import gc
@@ -31,22 +47,6 @@
3147
GIT_REPO = os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE", ospd(ospd(ospd(__file__))))
3248
GIT_DAEMON_PORT = os.environ.get("GIT_PYTHON_TEST_GIT_DAEMON_PORT", "19418")
3349

34-
__all__ = (
35-
"fixture_path",
36-
"fixture",
37-
"StringProcessAdapter",
38-
"with_rw_directory",
39-
"with_rw_repo",
40-
"with_rw_and_rw_remote_repo",
41-
"TestBase",
42-
"VirtualEnvironment",
43-
"TestCase",
44-
"SkipTest",
45-
"skipIf",
46-
"GIT_REPO",
47-
"GIT_DAEMON_PORT",
48-
)
49-
5050
_logger = logging.getLogger(__name__)
5151

5252
# { Routines

‎test/performance/__init__.py

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This module is part of GitPython and is released under the
2+
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/

‎test/performance/lib.py

Copy file name to clipboardExpand all lines: test/performance/lib.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import logging
77
import os
8+
import os.path as osp
89
import tempfile
910

1011
from git import Repo
1112
from git.db import GitCmdObjectDB, GitDB
12-
from test.lib import TestBase
1313
from git.util import rmtree
14-
import os.path as osp
14+
15+
from test.lib import TestBase
1516

1617
# { Invariants
1718

‎test/performance/test_commit.py

Copy file name to clipboardExpand all lines: test/performance/test_commit.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
from time import time
1111
import sys
1212

13-
from .lib import TestBigRepoRW
14-
from git import Commit
1513
from gitdb import IStream
14+
15+
from git import Commit
16+
17+
from test.performance.lib import TestBigRepoRW
1618
from test.test_commit import TestCommitSerialization
1719

1820

‎test/performance/test_odb.py

Copy file name to clipboardExpand all lines: test/performance/test_odb.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77
from time import time
88

9-
from .lib import TestBigRepoR
9+
from test.performance.lib import TestBigRepoR
1010

1111

1212
class TestObjDBPerformance(TestBigRepoR):

‎test/performance/test_streams.py

Copy file name to clipboardExpand all lines: test/performance/test_streams.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
import gc
77
import os
8+
import os.path as osp
89
import subprocess
910
import sys
1011
from time import time
1112

12-
from test.lib import with_rw_repo
13-
from git.util import bin_to_hex
1413
from gitdb import LooseObjectDB, IStream
1514
from gitdb.test.lib import make_memory_file
1615

17-
import os.path as osp
16+
from git.util import bin_to_hex
1817

19-
from .lib import TestBigRepoR
18+
from test.lib import with_rw_repo
19+
from test.performance.lib import TestBigRepoR
2020

2121

2222
class TestObjDBPerformance(TestBigRepoR):

‎test/test_actor.py

Copy file name to clipboardExpand all lines: test/test_actor.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
from test.lib import TestBase
76
from git import Actor
87

8+
from test.lib import TestBase
9+
910

1011
class TestActor(TestBase):
1112
def test_from_string_should_separate_name_and_email(self):

‎test/test_base.py

Copy file name to clipboardExpand all lines: test/test_base.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
import gc
77
import os
8+
import os.path as osp
89
import sys
910
import tempfile
1011
from unittest import skipIf
1112

1213
from git import Repo
13-
from git.objects import Blob, Tree, Commit, TagObject
14+
from git.objects import Blob, Commit, TagObject, Tree
15+
import git.objects.base as base
1416
from git.objects.util import get_object_type_by_name
15-
from test.lib import TestBase as _TestBase, with_rw_repo, with_rw_and_rw_remote_repo
16-
from git.util import hex_to_bin, HIDE_WINDOWS_FREEZE_ERRORS
17+
from git.util import HIDE_WINDOWS_FREEZE_ERRORS, hex_to_bin
1718

18-
import git.objects.base as base
19-
import os.path as osp
19+
from test.lib import TestBase as _TestBase, with_rw_and_rw_remote_repo, with_rw_repo
2020

2121

2222
class TestBase(_TestBase):

‎test/test_blob.py

Copy file name to clipboardExpand all lines: test/test_blob.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
from test.lib import TestBase
76
from git import Blob
87

8+
from test.lib import TestBase
9+
910

1011
class TestBlob(TestBase):
1112
def test_mime_type_should_return_mime_type_for_known_types(self):

‎test/test_clone.py

Copy file name to clipboardExpand all lines: test/test_clone.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
import git
88

9-
from .lib import (
10-
TestBase,
11-
with_rw_directory,
12-
)
9+
from test.lib import TestBase, with_rw_directory
1310

1411

1512
class TestClone(TestBase):

‎test/test_commit.py

Copy file name to clipboardExpand all lines: test/test_commit.py
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@
66
import copy
77
from datetime import datetime
88
from io import BytesIO
9+
import os.path as osp
910
import re
1011
import sys
1112
import time
1213
from unittest.mock import Mock
1314

14-
from git import (
15-
Commit,
16-
Actor,
17-
)
18-
from git import Repo
15+
from gitdb import IStream
16+
17+
from git import Actor, Commit, Repo
1918
from git.objects.util import tzoffset, utc
2019
from git.repo.fun import touch
21-
from test.lib import TestBase, with_rw_repo, fixture_path, StringProcessAdapter
22-
from test.lib import with_rw_directory
23-
from gitdb import IStream
2420

25-
import os.path as osp
21+
from test.lib import (
22+
StringProcessAdapter,
23+
TestBase,
24+
fixture_path,
25+
with_rw_directory,
26+
with_rw_repo,
27+
)
2628

2729

2830
class TestCommitSerialization(TestBase):

‎test/test_config.py

Copy file name to clipboardExpand all lines: test/test_config.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from git import GitConfigParser
1616
from git.config import _OMD, cp
1717
from git.util import rmfile
18-
from test.lib import SkipTest, TestCase, fixture_path, with_rw_directory
1918

19+
from test.lib import SkipTest, TestCase, fixture_path, with_rw_directory
2020

2121
_tc_lock_fpaths = osp.join(osp.dirname(__file__), "fixtures/*.lock")
2222

‎test/test_db.py

Copy file name to clipboardExpand all lines: test/test_db.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6+
import os.path as osp
7+
68
from git.db import GitCmdObjectDB
79
from git.exc import BadObject
8-
from test.lib import TestBase
910
from git.util import bin_to_hex
1011

11-
import os.path as osp
12+
from test.lib import TestBase
1213

1314

1415
class TestDB(TestBase):

‎test/test_diff.py

Copy file name to clipboardExpand all lines: test/test_diff.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from git import NULL_TREE, Diff, DiffIndex, Diffable, GitCommandError, Repo, Submodule
1616
from git.cmd import Git
17+
1718
from test.lib import StringProcessAdapter, TestBase, fixture, with_rw_directory
1819

1920

‎test/test_docs.py

Copy file name to clipboardExpand all lines: test/test_docs.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55

66
import gc
77
import os
8+
import os.path
89
import sys
910

1011
import pytest
1112

1213
from test.lib import TestBase
1314
from test.lib.helper import with_rw_directory
1415

15-
import os.path
16-
1716

1817
class Tutorials(TestBase):
1918
def tearDown(self):

‎test/test_exc.py

Copy file name to clipboardExpand all lines: test/test_exc.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6+
from itertools import product
67
import re
78

89
import ddt
10+
911
from git.exc import (
1012
InvalidGitRepositoryError,
1113
WorkTreeRepositoryUnsupported,
@@ -20,9 +22,8 @@
2022
RepositoryDirtyError,
2123
)
2224
from git.util import remove_password_if_present
23-
from test.lib import TestBase
2425

25-
import itertools as itt
26+
from test.lib import TestBase
2627

2728

2829
_cmd_argvs = (
@@ -79,7 +80,7 @@ def test_ExceptionsHaveBaseClass(self):
7980
for ex_class in exception_classes:
8081
self.assertTrue(issubclass(ex_class, GitError))
8182

82-
@ddt.data(*list(itt.product(_cmd_argvs, _causes_n_substrings, _streams_n_substrings)))
83+
@ddt.data(*list(product(_cmd_argvs, _causes_n_substrings, _streams_n_substrings)))
8384
def test_CommandError_unicode(self, case):
8485
argv, (cause, subs), stream = case
8586
cls = CommandError

‎test/test_fun.py

Copy file name to clipboardExpand all lines: test/test_fun.py
+8-9Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,26 @@
22
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
33

44
from io import BytesIO
5-
from stat import S_IFDIR, S_IFREG, S_IFLNK, S_IXUSR
5+
from stat import S_IFDIR, S_IFLNK, S_IFREG, S_IXUSR
66
from os import stat
77
import os.path as osp
88

9+
from gitdb.base import IStream
10+
from gitdb.typ import str_tree_type
11+
912
from git import Git
1013
from git.index import IndexFile
11-
from git.index.fun import (
12-
aggressive_tree_merge,
13-
stat_mode_to_index_mode,
14-
)
14+
from git.index.fun import aggressive_tree_merge, stat_mode_to_index_mode
1515
from git.objects.fun import (
1616
traverse_tree_recursive,
1717
traverse_trees_recursive,
18-
tree_to_stream,
1918
tree_entries_from_data,
19+
tree_to_stream,
2020
)
2121
from git.repo.fun import find_worktree_git_dir
22-
from test.lib import TestBase, with_rw_repo, with_rw_directory
2322
from git.util import bin_to_hex, cygpath, join_path_native
24-
from gitdb.base import IStream
25-
from gitdb.typ import str_tree_type
23+
24+
from test.lib import TestBase, with_rw_directory, with_rw_repo
2625

2726

2827
class TestFun(TestBase):

‎test/test_git.py

Copy file name to clipboardExpand all lines: test/test_git.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626
import ddt
2727

28-
from git import Git, refresh, GitCommandError, GitCommandNotFound, Repo, cmd
28+
from git import Git, GitCommandError, GitCommandNotFound, Repo, cmd, refresh
2929
from git.util import cwd, finalize_process
30+
3031
from test.lib import TestBase, fixture_path, with_rw_directory
3132

3233

‎test/test_index.py

Copy file name to clipboardExpand all lines: test/test_index.py
+4-10Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,12 @@
1717
import sys
1818
import tempfile
1919

20+
from gitdb.base import IStream
21+
2022
import ddt
2123
import pytest
2224

23-
from git import (
24-
BlobFilter,
25-
Diff,
26-
Git,
27-
IndexFile,
28-
Object,
29-
Repo,
30-
Tree,
31-
)
25+
from git import BlobFilter, Diff, Git, IndexFile, Object, Repo, Tree
3226
from git.exc import (
3327
CheckoutError,
3428
GitCommandError,
@@ -41,7 +35,7 @@
4135
from git.index.util import TemporaryFileSwap
4236
from git.objects import Blob
4337
from git.util import Actor, cwd, hex_to_bin, rmtree
44-
from gitdb.base import IStream
38+
4539
from test.lib import (
4640
TestBase,
4741
VirtualEnvironment,

‎test/test_reflog.py

Copy file name to clipboardExpand all lines: test/test_reflog.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
import tempfile
66

77
from git.objects import IndexObject
8-
from git.refs import RefLogEntry, RefLog
8+
from git.refs import RefLog, RefLogEntry
9+
from git.util import Actor, hex_to_bin, rmtree
10+
911
from test.lib import TestBase, fixture_path
10-
from git.util import Actor, rmtree, hex_to_bin
1112

1213

1314
class TestRefLog(TestBase):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.