Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4a4d880

Browse files
committed
Improve test suite import grouping/sorting, __all__ placement
There is only one __all__ in the test suite, so this is mostly thechange to imports, grouping and sorting them in a fully consistentstyle that is the same as the import style in the code under test.
1 parentf705fd6 commit4a4d880

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
importcontextlib
723
fromfunctoolsimportwraps
824
importgc
@@ -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
importlogging
77
importos
8+
importos.pathasosp
89
importtempfile
910

1011
fromgitimportRepo
1112
fromgit.dbimportGitCmdObjectDB,GitDB
12-
fromtest.libimportTestBase
1313
fromgit.utilimportrmtree
14-
importos.pathasosp
14+
15+
fromtest.libimportTestBase
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
fromtimeimporttime
1111
importsys
1212

13-
from .libimportTestBigRepoRW
14-
fromgitimportCommit
1513
fromgitdbimportIStream
14+
15+
fromgitimportCommit
16+
17+
fromtest.performance.libimportTestBigRepoRW
1618
fromtest.test_commitimportTestCommitSerialization
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
importsys
77
fromtimeimporttime
88

9-
from .libimportTestBigRepoR
9+
fromtest.performance.libimportTestBigRepoR
1010

1111

1212
classTestObjDBPerformance(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
importgc
77
importos
8+
importos.pathasosp
89
importsubprocess
910
importsys
1011
fromtimeimporttime
1112

12-
fromtest.libimportwith_rw_repo
13-
fromgit.utilimportbin_to_hex
1413
fromgitdbimportLooseObjectDB,IStream
1514
fromgitdb.test.libimportmake_memory_file
1615

17-
importos.pathasosp
16+
fromgit.utilimportbin_to_hex
1817

19-
from .libimportTestBigRepoR
18+
fromtest.libimportwith_rw_repo
19+
fromtest.performance.libimportTestBigRepoR
2020

2121

2222
classTestObjDBPerformance(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-
fromtest.libimportTestBase
76
fromgitimportActor
87

8+
fromtest.libimportTestBase
9+
910

1011
classTestActor(TestBase):
1112
deftest_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
importgc
77
importos
8+
importos.pathasosp
89
importsys
910
importtempfile
1011
fromunittestimportskipIf
1112

1213
fromgitimportRepo
13-
fromgit.objectsimportBlob,Tree,Commit,TagObject
14+
fromgit.objectsimportBlob,Commit,TagObject,Tree
15+
importgit.objects.baseasbase
1416
fromgit.objects.utilimportget_object_type_by_name
15-
fromtest.libimportTestBaseas_TestBase,with_rw_repo,with_rw_and_rw_remote_repo
16-
fromgit.utilimporthex_to_bin,HIDE_WINDOWS_FREEZE_ERRORS
17+
fromgit.utilimportHIDE_WINDOWS_FREEZE_ERRORS,hex_to_bin
1718

18-
importgit.objects.baseasbase
19-
importos.pathasosp
19+
fromtest.libimportTestBaseas_TestBase,with_rw_and_rw_remote_repo,with_rw_repo
2020

2121

2222
classTestBase(_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-
fromtest.libimportTestBase
76
fromgitimportBlob
87

8+
fromtest.libimportTestBase
9+
910

1011
classTestBlob(TestBase):
1112
deftest_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
importgit
88

9-
from .libimport (
10-
TestBase,
11-
with_rw_directory,
12-
)
9+
fromtest.libimportTestBase,with_rw_directory
1310

1411

1512
classTestClone(TestBase):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp