Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a4d880

Browse 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

27 files changed

+99
-95
lines changed

test/lib/helper.py

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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):

0 commit comments

Comments
 (0)