diff options
52 files changed, 280 insertions, 143 deletions
diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 00000000..bc47b614 --- /dev/null +++ b/.isort.cfg | |||
@@ -0,0 +1,41 @@ | |||
1 | # Copyright 2023 The Android Open Source Project | ||
2 | # | ||
3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
4 | # you may not use this file except in compliance with the License. | ||
5 | # You may obtain a copy of the License at | ||
6 | # | ||
7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
8 | # | ||
9 | # Unless required by applicable law or agreed to in writing, software | ||
10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
12 | # See the License for the specific language governing permissions and | ||
13 | # limitations under the License. | ||
14 | |||
15 | # Config file for the isort python module. | ||
16 | # This is used to enforce import sorting standards. | ||
17 | # | ||
18 | # https://pycqa.github.io/isort/docs/configuration/options.html | ||
19 | |||
20 | [settings] | ||
21 | # Be compatible with `black` since it also matches what we want. | ||
22 | profile = black | ||
23 | |||
24 | line_length = 80 | ||
25 | length_sort = false | ||
26 | force_single_line = true | ||
27 | lines_after_imports = 2 | ||
28 | from_first = false | ||
29 | case_sensitive = false | ||
30 | force_sort_within_sections = true | ||
31 | order_by_type = false | ||
32 | |||
33 | # Ignore generated files. | ||
34 | extend_skip_glob = *_pb2.py | ||
35 | |||
36 | # Allow importing multiple classes on a single line from these modules. | ||
37 | # https://google.github.io/styleguide/pyguide#s2.2-imports | ||
38 | single_line_exclusions = | ||
39 | abc, | ||
40 | collections.abc, | ||
41 | typing, | ||
@@ -17,6 +17,7 @@ import sys | |||
17 | 17 | ||
18 | import pager | 18 | import pager |
19 | 19 | ||
20 | |||
20 | COLORS = { | 21 | COLORS = { |
21 | None: -1, | 22 | None: -1, |
22 | "normal": -1, | 23 | "normal": -1, |
@@ -13,14 +13,14 @@ | |||
13 | # limitations under the License. | 13 | # limitations under the License. |
14 | 14 | ||
15 | import multiprocessing | 15 | import multiprocessing |
16 | import os | ||
17 | import optparse | 16 | import optparse |
17 | import os | ||
18 | import re | 18 | import re |
19 | 19 | ||
20 | from event_log import EventLog | ||
21 | from error import NoSuchProjectError | ||
22 | from error import InvalidProjectGroupsError | 20 | from error import InvalidProjectGroupsError |
21 | from error import NoSuchProjectError | ||
23 | from error import RepoExitError | 22 | from error import RepoExitError |
23 | from event_log import EventLog | ||
24 | import progress | 24 | import progress |
25 | 25 | ||
26 | 26 | ||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | import os | 15 | import os |
16 | import re | 16 | import re |
17 | import sys | ||
18 | import subprocess | 17 | import subprocess |
18 | import sys | ||
19 | import tempfile | 19 | import tempfile |
20 | 20 | ||
21 | from error import EditorError | 21 | from error import EditorError |
diff --git a/event_log.py b/event_log.py index b1f8bdf9..60c1a437 100644 --- a/event_log.py +++ b/event_log.py | |||
@@ -15,6 +15,7 @@ | |||
15 | import json | 15 | import json |
16 | import multiprocessing | 16 | import multiprocessing |
17 | 17 | ||
18 | |||
18 | TASK_COMMAND = "command" | 19 | TASK_COMMAND = "command" |
19 | TASK_SYNC_NETWORK = "sync-network" | 20 | TASK_SYNC_NETWORK = "sync-network" |
20 | TASK_SYNC_LOCAL = "sync-local" | 21 | TASK_SYNC_LOCAL = "sync-local" |
@@ -18,6 +18,7 @@ import subprocess | |||
18 | import sys | 18 | import sys |
19 | from urllib.parse import urlparse | 19 | from urllib.parse import urlparse |
20 | from urllib.request import urlopen | 20 | from urllib.request import urlopen |
21 | |||
21 | from error import RepoExitError | 22 | from error import RepoExitError |
22 | 23 | ||
23 | 24 | ||
diff --git a/git_command.py b/git_command.py index 36fcfe7c..a5cf514b 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -14,17 +14,20 @@ | |||
14 | 14 | ||
15 | import functools | 15 | import functools |
16 | import os | 16 | import os |
17 | import sys | ||
18 | import subprocess | 17 | import subprocess |
18 | import sys | ||
19 | from typing import Any, Optional | 19 | from typing import Any, Optional |
20 | 20 | ||
21 | from error import GitError | 21 | from error import GitError |
22 | from error import RepoExitError | 22 | from error import RepoExitError |
23 | from git_refs import HEAD | 23 | from git_refs import HEAD |
24 | import platform_utils | 24 | import platform_utils |
25 | from repo_trace import REPO_TRACE, IsTrace, Trace | 25 | from repo_trace import IsTrace |
26 | from repo_trace import REPO_TRACE | ||
27 | from repo_trace import Trace | ||
26 | from wrapper import Wrapper | 28 | from wrapper import Wrapper |
27 | 29 | ||
30 | |||
28 | GIT = "git" | 31 | GIT = "git" |
29 | # NB: These do not need to be kept in sync with the repo launcher script. | 32 | # NB: These do not need to be kept in sync with the repo launcher script. |
30 | # These may be much newer as it allows the repo launcher to roll between | 33 | # These may be much newer as it allows the repo launcher to roll between |
diff --git a/git_config.py b/git_config.py index 971066ef..8c2eb6e9 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -26,11 +26,15 @@ from typing import Union | |||
26 | import urllib.error | 26 | import urllib.error |
27 | import urllib.request | 27 | import urllib.request |
28 | 28 | ||
29 | from error import GitError, UploadError | 29 | from error import GitError |
30 | from error import UploadError | ||
31 | from git_command import GitCommand | ||
32 | from git_refs import R_CHANGES | ||
33 | from git_refs import R_HEADS | ||
34 | from git_refs import R_TAGS | ||
30 | import platform_utils | 35 | import platform_utils |
31 | from repo_trace import Trace | 36 | from repo_trace import Trace |
32 | from git_command import GitCommand | 37 | |
33 | from git_refs import R_CHANGES, R_HEADS, R_TAGS | ||
34 | 38 | ||
35 | # Prefix that is prepended to all the keys of SyncAnalysisState's data | 39 | # Prefix that is prepended to all the keys of SyncAnalysisState's data |
36 | # that is saved in the config. | 40 | # that is saved in the config. |
diff --git a/git_refs.py b/git_refs.py index aca1f90d..1f5eaab4 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -13,8 +13,10 @@ | |||
13 | # limitations under the License. | 13 | # limitations under the License. |
14 | 14 | ||
15 | import os | 15 | import os |
16 | from repo_trace import Trace | 16 | |
17 | import platform_utils | 17 | import platform_utils |
18 | from repo_trace import Trace | ||
19 | |||
18 | 20 | ||
19 | HEAD = "HEAD" | 21 | HEAD = "HEAD" |
20 | R_CHANGES = "refs/changes/" | 22 | R_CHANGES = "refs/changes/" |
diff --git a/git_superproject.py b/git_superproject.py index f1b4f231..5d8c0d4e 100644 --- a/git_superproject.py +++ b/git_superproject.py | |||
@@ -22,17 +22,19 @@ Examples: | |||
22 | UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects) | 22 | UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects) |
23 | """ | 23 | """ |
24 | 24 | ||
25 | import hashlib | ||
26 | import functools | 25 | import functools |
26 | import hashlib | ||
27 | import os | 27 | import os |
28 | import sys | 28 | import sys |
29 | import time | 29 | import time |
30 | from typing import NamedTuple | 30 | from typing import NamedTuple |
31 | 31 | ||
32 | from git_command import git_require, GitCommand | 32 | from git_command import git_require |
33 | from git_command import GitCommand | ||
33 | from git_config import RepoConfig | 34 | from git_config import RepoConfig |
34 | from git_refs import GitRefs | 35 | from git_refs import GitRefs |
35 | 36 | ||
37 | |||
36 | _SUPERPROJECT_GIT_NAME = "superproject.git" | 38 | _SUPERPROJECT_GIT_NAME = "superproject.git" |
37 | _SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml" | 39 | _SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml" |
38 | 40 | ||
diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py index 5b99867b..f26f8311 100644 --- a/git_trace2_event_log.py +++ b/git_trace2_event_log.py | |||
@@ -37,7 +37,8 @@ import sys | |||
37 | import tempfile | 37 | import tempfile |
38 | import threading | 38 | import threading |
39 | 39 | ||
40 | from git_command import GitCommand, RepoSourceVersion | 40 | from git_command import GitCommand |
41 | from git_command import RepoSourceVersion | ||
41 | 42 | ||
42 | 43 | ||
43 | class EventLog(object): | 44 | class EventLog(object): |
@@ -21,6 +21,7 @@ which takes care of execing this entry point. | |||
21 | """ | 21 | """ |
22 | 22 | ||
23 | import getpass | 23 | import getpass |
24 | import json | ||
24 | import netrc | 25 | import netrc |
25 | import optparse | 26 | import optparse |
26 | import os | 27 | import os |
@@ -30,7 +31,7 @@ import sys | |||
30 | import textwrap | 31 | import textwrap |
31 | import time | 32 | import time |
32 | import urllib.request | 33 | import urllib.request |
33 | import json | 34 | |
34 | 35 | ||
35 | try: | 36 | try: |
36 | import kerberos | 37 | import kerberos |
@@ -38,31 +39,34 @@ except ImportError: | |||
38 | kerberos = None | 39 | kerberos = None |
39 | 40 | ||
40 | from color import SetDefaultColoring | 41 | from color import SetDefaultColoring |
41 | import event_log | ||
42 | from repo_trace import SetTrace, Trace, SetTraceToStderr | ||
43 | from git_command import user_agent | ||
44 | from git_config import RepoConfig | ||
45 | from git_trace2_event_log import EventLog | ||
46 | from command import InteractiveCommand | 42 | from command import InteractiveCommand |
47 | from command import MirrorSafeCommand | 43 | from command import MirrorSafeCommand |
48 | from subcmds.version import Version | ||
49 | from editor import Editor | 44 | from editor import Editor |
50 | from error import DownloadError | 45 | from error import DownloadError |
46 | from error import GitcUnsupportedError | ||
51 | from error import InvalidProjectGroupsError | 47 | from error import InvalidProjectGroupsError |
52 | from error import ManifestInvalidRevisionError | 48 | from error import ManifestInvalidRevisionError |
53 | from error import NoManifestException | 49 | from error import NoManifestException |
54 | from error import NoSuchProjectError | 50 | from error import NoSuchProjectError |
55 | from error import RepoChangedException | 51 | from error import RepoChangedException |
52 | from error import RepoError | ||
56 | from error import RepoExitError | 53 | from error import RepoExitError |
57 | from error import RepoUnhandledExceptionError | 54 | from error import RepoUnhandledExceptionError |
58 | from error import RepoError | ||
59 | from error import SilentRepoExitError | 55 | from error import SilentRepoExitError |
60 | from error import GitcUnsupportedError | 56 | import event_log |
57 | from git_command import user_agent | ||
58 | from git_config import RepoConfig | ||
59 | from git_trace2_event_log import EventLog | ||
61 | from manifest_xml import RepoClient | 60 | from manifest_xml import RepoClient |
62 | from pager import RunPager, TerminatePager | 61 | from pager import RunPager |
63 | from wrapper import WrapperPath, Wrapper | 62 | from pager import TerminatePager |
64 | 63 | from repo_trace import SetTrace | |
64 | from repo_trace import SetTraceToStderr | ||
65 | from repo_trace import Trace | ||
65 | from subcmds import all_commands | 66 | from subcmds import all_commands |
67 | from subcmds.version import Version | ||
68 | from wrapper import Wrapper | ||
69 | from wrapper import WrapperPath | ||
66 | 70 | ||
67 | 71 | ||
68 | # NB: These do not need to be kept in sync with the repo launcher script. | 72 | # NB: These do not need to be kept in sync with the repo launcher script. |
diff --git a/manifest_xml.py b/manifest_xml.py index 80e563a5..d944b409 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -18,27 +18,25 @@ import os | |||
18 | import platform | 18 | import platform |
19 | import re | 19 | import re |
20 | import sys | 20 | import sys |
21 | import xml.dom.minidom | ||
22 | import urllib.parse | 21 | import urllib.parse |
22 | import xml.dom.minidom | ||
23 | 23 | ||
24 | from error import ManifestInvalidPathError | ||
25 | from error import ManifestInvalidRevisionError | ||
26 | from error import ManifestParseError | ||
24 | from git_config import GitConfig | 27 | from git_config import GitConfig |
25 | from git_refs import R_HEADS, HEAD | 28 | from git_refs import HEAD |
29 | from git_refs import R_HEADS | ||
26 | from git_superproject import Superproject | 30 | from git_superproject import Superproject |
27 | import platform_utils | 31 | import platform_utils |
28 | from project import ( | 32 | from project import Annotation |
29 | Annotation, | 33 | from project import ManifestProject |
30 | RemoteSpec, | 34 | from project import Project |
31 | Project, | 35 | from project import RemoteSpec |
32 | RepoProject, | 36 | from project import RepoProject |
33 | ManifestProject, | ||
34 | ) | ||
35 | from error import ( | ||
36 | ManifestParseError, | ||
37 | ManifestInvalidPathError, | ||
38 | ManifestInvalidRevisionError, | ||
39 | ) | ||
40 | from wrapper import Wrapper | 37 | from wrapper import Wrapper |
41 | 38 | ||
39 | |||
42 | MANIFEST_FILE_NAME = "manifest.xml" | 40 | MANIFEST_FILE_NAME = "manifest.xml" |
43 | LOCAL_MANIFEST_NAME = "local_manifest.xml" | 41 | LOCAL_MANIFEST_NAME = "local_manifest.xml" |
44 | LOCAL_MANIFESTS_DIR_NAME = "local_manifests" | 42 | LOCAL_MANIFESTS_DIR_NAME = "local_manifests" |
@@ -19,6 +19,7 @@ import sys | |||
19 | 19 | ||
20 | import platform_utils | 20 | import platform_utils |
21 | 21 | ||
22 | |||
22 | active = False | 23 | active = False |
23 | pager_process = None | 24 | pager_process = None |
24 | old_stdout = None | 25 | old_stdout = None |
diff --git a/platform_utils_win32.py b/platform_utils_win32.py index e9b15f46..80a52639 100644 --- a/platform_utils_win32.py +++ b/platform_utils_win32.py | |||
@@ -12,12 +12,28 @@ | |||
12 | # See the License for the specific language governing permissions and | 12 | # See the License for the specific language governing permissions and |
13 | # limitations under the License. | 13 | # limitations under the License. |
14 | 14 | ||
15 | from ctypes import addressof | ||
16 | from ctypes import byref | ||
17 | from ctypes import c_buffer | ||
18 | from ctypes import c_ubyte | ||
19 | from ctypes import FormatError | ||
20 | from ctypes import get_last_error | ||
21 | from ctypes import Structure | ||
22 | from ctypes import Union | ||
23 | from ctypes import WinDLL | ||
24 | from ctypes import WinError | ||
25 | from ctypes.wintypes import BOOL | ||
26 | from ctypes.wintypes import BOOLEAN | ||
27 | from ctypes.wintypes import DWORD | ||
28 | from ctypes.wintypes import HANDLE | ||
29 | from ctypes.wintypes import LPCWSTR | ||
30 | from ctypes.wintypes import LPDWORD | ||
31 | from ctypes.wintypes import LPVOID | ||
32 | from ctypes.wintypes import ULONG | ||
33 | from ctypes.wintypes import USHORT | ||
34 | from ctypes.wintypes import WCHAR | ||
15 | import errno | 35 | import errno |
16 | 36 | ||
17 | from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof | ||
18 | from ctypes import c_buffer, c_ubyte, Structure, Union, byref | ||
19 | from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE | ||
20 | from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG, LPDWORD | ||
21 | 37 | ||
22 | kernel32 = WinDLL("kernel32", use_last_error=True) | 38 | kernel32 = WinDLL("kernel32", use_last_error=True) |
23 | 39 | ||
diff --git a/progress.py b/progress.py index f2edf144..80bc9463 100644 --- a/progress.py +++ b/progress.py | |||
@@ -16,6 +16,7 @@ import os | |||
16 | import sys | 16 | import sys |
17 | import time | 17 | import time |
18 | 18 | ||
19 | |||
19 | try: | 20 | try: |
20 | import threading as _threading | 21 | import threading as _threading |
21 | except ImportError: | 22 | except ImportError: |
@@ -23,6 +24,7 @@ except ImportError: | |||
23 | 24 | ||
24 | from repo_trace import IsTraceToStderr | 25 | from repo_trace import IsTraceToStderr |
25 | 26 | ||
27 | |||
26 | _TTY = sys.stderr.isatty() | 28 | _TTY = sys.stderr.isatty() |
27 | 29 | ||
28 | # This will erase all content in the current line (wherever the cursor is). | 30 | # This will erase all content in the current line (wherever the cursor is). |
@@ -26,35 +26,39 @@ import sys | |||
26 | import tarfile | 26 | import tarfile |
27 | import tempfile | 27 | import tempfile |
28 | import time | 28 | import time |
29 | from typing import NamedTuple, List | 29 | from typing import List, NamedTuple |
30 | import urllib.parse | 30 | import urllib.parse |
31 | 31 | ||
32 | from color import Coloring | 32 | from color import Coloring |
33 | from error import DownloadError | ||
34 | from error import GitError | ||
35 | from error import ManifestInvalidPathError | ||
36 | from error import ManifestInvalidRevisionError | ||
37 | from error import ManifestParseError | ||
38 | from error import NoManifestException | ||
39 | from error import RepoError | ||
40 | from error import UploadError | ||
33 | import fetch | 41 | import fetch |
34 | from git_command import GitCommand, git_require | 42 | from git_command import git_require |
35 | from git_config import ( | 43 | from git_command import GitCommand |
36 | GitConfig, | 44 | from git_config import GetSchemeFromUrl |
37 | IsId, | 45 | from git_config import GetUrlCookieFile |
38 | GetSchemeFromUrl, | 46 | from git_config import GitConfig |
39 | GetUrlCookieFile, | 47 | from git_config import ID_RE |
40 | ID_RE, | 48 | from git_config import IsId |
41 | ) | 49 | from git_refs import GitRefs |
50 | from git_refs import HEAD | ||
51 | from git_refs import R_HEADS | ||
52 | from git_refs import R_M | ||
53 | from git_refs import R_PUB | ||
54 | from git_refs import R_TAGS | ||
55 | from git_refs import R_WORKTREE_M | ||
42 | import git_superproject | 56 | import git_superproject |
43 | from git_trace2_event_log import EventLog | 57 | from git_trace2_event_log import EventLog |
44 | from error import ( | ||
45 | GitError, | ||
46 | UploadError, | ||
47 | DownloadError, | ||
48 | RepoError, | ||
49 | ) | ||
50 | from error import ManifestInvalidRevisionError, ManifestInvalidPathError | ||
51 | from error import NoManifestException, ManifestParseError | ||
52 | import platform_utils | 58 | import platform_utils |
53 | import progress | 59 | import progress |
54 | from repo_trace import Trace | 60 | from repo_trace import Trace |
55 | 61 | ||
56 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M | ||
57 | |||
58 | 62 | ||
59 | class SyncNetworkHalfResult(NamedTuple): | 63 | class SyncNetworkHalfResult(NamedTuple): |
60 | """Sync_NetworkHalf return value.""" | 64 | """Sync_NetworkHalf return value.""" |
diff --git a/release/update-manpages b/release/update-manpages index 0402ad66..6679b179 100755 --- a/release/update-manpages +++ b/release/update-manpages | |||
@@ -22,4 +22,5 @@ import sys | |||
22 | 22 | ||
23 | import update_manpages | 23 | import update_manpages |
24 | 24 | ||
25 | |||
25 | sys.exit(update_manpages.main(sys.argv[1:])) | 26 | sys.exit(update_manpages.main(sys.argv[1:])) |
diff --git a/release/update_manpages.py b/release/update_manpages.py index cb687245..489de357 100644 --- a/release/update_manpages.py +++ b/release/update_manpages.py | |||
@@ -17,17 +17,18 @@ | |||
17 | Most code lives in this module so it can be unittested. | 17 | Most code lives in this module so it can be unittested. |
18 | """ | 18 | """ |
19 | 19 | ||
20 | from pathlib import Path | ||
21 | import argparse | 20 | import argparse |
22 | import functools | 21 | import functools |
23 | import multiprocessing | 22 | import multiprocessing |
24 | import os | 23 | import os |
24 | from pathlib import Path | ||
25 | import re | 25 | import re |
26 | import shutil | 26 | import shutil |
27 | import subprocess | 27 | import subprocess |
28 | import sys | 28 | import sys |
29 | import tempfile | 29 | import tempfile |
30 | 30 | ||
31 | |||
31 | TOPDIR = Path(__file__).resolve().parent.parent | 32 | TOPDIR = Path(__file__).resolve().parent.parent |
32 | MANDIR = TOPDIR.joinpath("man") | 33 | MANDIR = TOPDIR.joinpath("man") |
33 | 34 | ||
@@ -254,11 +254,13 @@ import re | |||
254 | import shutil | 254 | import shutil |
255 | import stat | 255 | import stat |
256 | 256 | ||
257 | |||
257 | if sys.version_info[0] == 3: | 258 | if sys.version_info[0] == 3: |
258 | import urllib.request | ||
259 | import urllib.error | 259 | import urllib.error |
260 | import urllib.request | ||
260 | else: | 261 | else: |
261 | import imp | 262 | import imp |
263 | |||
262 | import urllib2 | 264 | import urllib2 |
263 | urllib = imp.new_module('urllib') | 265 | urllib = imp.new_module('urllib') |
264 | urllib.request = urllib2 | 266 | urllib.request = urllib2 |
diff --git a/repo_logging.py b/repo_logging.py index 67db05fb..b748df4f 100644 --- a/repo_logging.py +++ b/repo_logging.py | |||
@@ -19,6 +19,7 @@ import multiprocessing | |||
19 | 19 | ||
20 | from color import Coloring | 20 | from color import Coloring |
21 | 21 | ||
22 | |||
22 | SEPARATOR = "=" * 80 | 23 | SEPARATOR = "=" * 80 |
23 | 24 | ||
24 | 25 | ||
diff --git a/repo_trace.py b/repo_trace.py index 01beaf8e..d243ce6c 100644 --- a/repo_trace.py +++ b/repo_trace.py | |||
@@ -21,13 +21,14 @@ To also include trace outputs in stderr do `repo --trace_to_stderr ...` | |||
21 | """ | 21 | """ |
22 | 22 | ||
23 | import contextlib | 23 | import contextlib |
24 | import sys | ||
25 | import os | 24 | import os |
26 | import time | 25 | import sys |
27 | import tempfile | 26 | import tempfile |
27 | import time | ||
28 | 28 | ||
29 | import platform_utils | 29 | import platform_utils |
30 | 30 | ||
31 | |||
31 | # Env var to implicitly turn on tracing. | 32 | # Env var to implicitly turn on tracing. |
32 | REPO_TRACE = "REPO_TRACE" | 33 | REPO_TRACE = "REPO_TRACE" |
33 | 34 | ||
@@ -18,6 +18,7 @@ | |||
18 | import os | 18 | import os |
19 | import subprocess | 19 | import subprocess |
20 | import sys | 20 | import sys |
21 | |||
21 | import pytest | 22 | import pytest |
22 | 23 | ||
23 | 24 | ||
@@ -38,12 +39,20 @@ def run_flake8(): | |||
38 | ).returncode | 39 | ).returncode |
39 | 40 | ||
40 | 41 | ||
42 | def run_isort(): | ||
43 | """Returns the exit code from isort.""" | ||
44 | return subprocess.run( | ||
45 | [sys.executable, "-m", "isort", "--check", ROOT_DIR], check=False | ||
46 | ).returncode | ||
47 | |||
48 | |||
41 | def main(argv): | 49 | def main(argv): |
42 | """The main entry.""" | 50 | """The main entry.""" |
43 | checks = ( | 51 | checks = ( |
44 | lambda: pytest.main(argv), | 52 | lambda: pytest.main(argv), |
45 | run_black, | 53 | run_black, |
46 | run_flake8, | 54 | run_flake8, |
55 | run_isort, | ||
47 | ) | 56 | ) |
48 | return 0 if all(not c() for c in checks) else 1 | 57 | return 0 if all(not c() for c in checks) else 1 |
49 | 58 | ||
diff --git a/run_tests.vpython3 b/run_tests.vpython3 index 3d0cd78e..036064d3 100644 --- a/run_tests.vpython3 +++ b/run_tests.vpython3 | |||
@@ -123,3 +123,8 @@ wheel: < | |||
123 | name: "infra/python/wheels/pycodestyle-py2_py3" | 123 | name: "infra/python/wheels/pycodestyle-py2_py3" |
124 | version: "version:2.10.0" | 124 | version: "version:2.10.0" |
125 | > | 125 | > |
126 | |||
127 | wheel: < | ||
128 | name: "infra/python/wheels/isort-py3" | ||
129 | version: "version:5.10.1" | ||
130 | > | ||
@@ -16,6 +16,7 @@ | |||
16 | """Python packaging for repo.""" | 16 | """Python packaging for repo.""" |
17 | 17 | ||
18 | import os | 18 | import os |
19 | |||
19 | import setuptools | 20 | import setuptools |
20 | 21 | ||
21 | 22 | ||
diff --git a/subcmds/__init__.py b/subcmds/__init__.py index 0754f708..965ad0bb 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | import os | 15 | import os |
16 | 16 | ||
17 | |||
17 | # A mapping of the subcommand name to the class that implements it. | 18 | # A mapping of the subcommand name to the class that implements it. |
18 | all_commands = {} | 19 | all_commands = {} |
19 | all_modules = [] | 20 | all_modules = [] |
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index 1499c75e..996c3d2c 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
@@ -17,10 +17,12 @@ import functools | |||
17 | import itertools | 17 | import itertools |
18 | import sys | 18 | import sys |
19 | 19 | ||
20 | from command import Command, DEFAULT_LOCAL_JOBS | 20 | from command import Command |
21 | from command import DEFAULT_LOCAL_JOBS | ||
22 | from error import RepoError | ||
23 | from error import RepoExitError | ||
21 | from git_command import git | 24 | from git_command import git |
22 | from progress import Progress | 25 | from progress import Progress |
23 | from error import RepoError, RepoExitError | ||
24 | 26 | ||
25 | 27 | ||
26 | class AbandonError(RepoExitError): | 28 | class AbandonError(RepoExitError): |
diff --git a/subcmds/branches.py b/subcmds/branches.py index 4d5bb196..33523c38 100644 --- a/subcmds/branches.py +++ b/subcmds/branches.py | |||
@@ -16,7 +16,8 @@ import itertools | |||
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | from color import Coloring | 18 | from color import Coloring |
19 | from command import Command, DEFAULT_LOCAL_JOBS | 19 | from command import Command |
20 | from command import DEFAULT_LOCAL_JOBS | ||
20 | 21 | ||
21 | 22 | ||
22 | class BranchColoring(Coloring): | 23 | class BranchColoring(Coloring): |
diff --git a/subcmds/checkout.py b/subcmds/checkout.py index 033fd349..67f1838c 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py | |||
@@ -14,12 +14,14 @@ | |||
14 | 14 | ||
15 | import functools | 15 | import functools |
16 | import sys | 16 | import sys |
17 | |||
18 | from typing import NamedTuple | 17 | from typing import NamedTuple |
19 | from command import Command, DEFAULT_LOCAL_JOBS | 18 | |
19 | from command import Command | ||
20 | from command import DEFAULT_LOCAL_JOBS | ||
21 | from error import GitError | ||
22 | from error import RepoExitError | ||
20 | from progress import Progress | 23 | from progress import Progress |
21 | from project import Project | 24 | from project import Project |
22 | from error import GitError, RepoExitError | ||
23 | 25 | ||
24 | 26 | ||
25 | class CheckoutBranchResult(NamedTuple): | 27 | class CheckoutBranchResult(NamedTuple): |
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py index 7a4dd09e..980720eb 100644 --- a/subcmds/cherry_pick.py +++ b/subcmds/cherry_pick.py | |||
@@ -14,9 +14,11 @@ | |||
14 | 14 | ||
15 | import re | 15 | import re |
16 | import sys | 16 | import sys |
17 | |||
17 | from command import Command | 18 | from command import Command |
18 | from git_command import GitCommand | ||
19 | from error import GitError | 19 | from error import GitError |
20 | from git_command import GitCommand | ||
21 | |||
20 | 22 | ||
21 | CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$") | 23 | CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$") |
22 | 24 | ||
diff --git a/subcmds/diff.py b/subcmds/diff.py index 5c627c0c..d9d72b40 100644 --- a/subcmds/diff.py +++ b/subcmds/diff.py | |||
@@ -15,7 +15,8 @@ | |||
15 | import functools | 15 | import functools |
16 | import io | 16 | import io |
17 | 17 | ||
18 | from command import DEFAULT_LOCAL_JOBS, PagedCommand | 18 | from command import DEFAULT_LOCAL_JOBS |
19 | from command import PagedCommand | ||
19 | 20 | ||
20 | 21 | ||
21 | class Diff(PagedCommand): | 22 | class Diff(PagedCommand): |
diff --git a/subcmds/download.py b/subcmds/download.py index 18e555be..e33698e1 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -16,7 +16,10 @@ import re | |||
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | from command import Command | 18 | from command import Command |
19 | from error import GitError, NoSuchProjectError, RepoExitError | 19 | from error import GitError |
20 | from error import NoSuchProjectError | ||
21 | from error import RepoExitError | ||
22 | |||
20 | 23 | ||
21 | CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$") | 24 | CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$") |
22 | 25 | ||
diff --git a/subcmds/forall.py b/subcmds/forall.py index 0a897357..9a02c49f 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -16,21 +16,20 @@ import errno | |||
16 | import functools | 16 | import functools |
17 | import io | 17 | import io |
18 | import multiprocessing | 18 | import multiprocessing |
19 | import re | ||
20 | import os | 19 | import os |
20 | import re | ||
21 | import signal | 21 | import signal |
22 | import sys | ||
23 | import subprocess | 22 | import subprocess |
23 | import sys | ||
24 | 24 | ||
25 | from color import Coloring | 25 | from color import Coloring |
26 | from command import ( | 26 | from command import Command |
27 | DEFAULT_LOCAL_JOBS, | 27 | from command import DEFAULT_LOCAL_JOBS |
28 | Command, | 28 | from command import MirrorSafeCommand |
29 | MirrorSafeCommand, | 29 | from command import WORKER_BATCH_SIZE |
30 | WORKER_BATCH_SIZE, | ||
31 | ) | ||
32 | from error import ManifestInvalidRevisionError | 30 | from error import ManifestInvalidRevisionError |
33 | 31 | ||
32 | |||
34 | _CAN_COLOR = [ | 33 | _CAN_COLOR = [ |
35 | "branch", | 34 | "branch", |
36 | "diff", | 35 | "diff", |
diff --git a/subcmds/grep.py b/subcmds/grep.py index 9ebd776c..19c06d4d 100644 --- a/subcmds/grep.py +++ b/subcmds/grep.py | |||
@@ -14,12 +14,15 @@ | |||
14 | 14 | ||
15 | import functools | 15 | import functools |
16 | import sys | 16 | import sys |
17 | from typing import NamedTuple | ||
17 | 18 | ||
18 | from color import Coloring | 19 | from color import Coloring |
19 | from command import DEFAULT_LOCAL_JOBS, PagedCommand | 20 | from command import DEFAULT_LOCAL_JOBS |
20 | from error import GitError, InvalidArgumentsError, SilentRepoExitError | 21 | from command import PagedCommand |
22 | from error import GitError | ||
23 | from error import InvalidArgumentsError | ||
24 | from error import SilentRepoExitError | ||
21 | from git_command import GitCommand | 25 | from git_command import GitCommand |
22 | from typing import NamedTuple | ||
23 | from project import Project | 26 | from project import Project |
24 | 27 | ||
25 | 28 | ||
diff --git a/subcmds/help.py b/subcmds/help.py index 0d7b664e..a839131b 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
@@ -16,14 +16,12 @@ import re | |||
16 | import sys | 16 | import sys |
17 | import textwrap | 17 | import textwrap |
18 | 18 | ||
19 | from subcmds import all_commands | ||
20 | from color import Coloring | 19 | from color import Coloring |
21 | from command import ( | 20 | from command import MirrorSafeCommand |
22 | PagedCommand, | 21 | from command import PagedCommand |
23 | MirrorSafeCommand, | ||
24 | ) | ||
25 | from wrapper import Wrapper | ||
26 | from error import RepoExitError | 22 | from error import RepoExitError |
23 | from subcmds import all_commands | ||
24 | from wrapper import Wrapper | ||
27 | 25 | ||
28 | 26 | ||
29 | class InvalidHelpCommand(RepoExitError): | 27 | class InvalidHelpCommand(RepoExitError): |
diff --git a/subcmds/info.py b/subcmds/info.py index 6e7f3ed2..c24682c7 100644 --- a/subcmds/info.py +++ b/subcmds/info.py | |||
@@ -14,9 +14,10 @@ | |||
14 | 14 | ||
15 | import optparse | 15 | import optparse |
16 | 16 | ||
17 | from command import PagedCommand | ||
18 | from color import Coloring | 17 | from color import Coloring |
19 | from git_refs import R_M, R_HEADS | 18 | from command import PagedCommand |
19 | from git_refs import R_HEADS | ||
20 | from git_refs import R_M | ||
20 | 21 | ||
21 | 22 | ||
22 | class _Coloring(Coloring): | 23 | class _Coloring(Coloring): |
diff --git a/subcmds/init.py b/subcmds/init.py index c5a2c54c..529b212b 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -16,11 +16,15 @@ import os | |||
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | from color import Coloring | 18 | from color import Coloring |
19 | from command import InteractiveCommand, MirrorSafeCommand | 19 | from command import InteractiveCommand |
20 | from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD | 20 | from command import MirrorSafeCommand |
21 | from wrapper import Wrapper | ||
22 | from error import UpdateManifestError | ||
23 | from error import RepoUnhandledExceptionError | 21 | from error import RepoUnhandledExceptionError |
22 | from error import UpdateManifestError | ||
23 | from git_command import git_require | ||
24 | from git_command import MIN_GIT_VERSION_HARD | ||
25 | from git_command import MIN_GIT_VERSION_SOFT | ||
26 | from wrapper import Wrapper | ||
27 | |||
24 | 28 | ||
25 | _REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW") | 29 | _REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW") |
26 | 30 | ||
diff --git a/subcmds/list.py b/subcmds/list.py index 24e3e1fc..fba6a4dc 100644 --- a/subcmds/list.py +++ b/subcmds/list.py | |||
@@ -14,7 +14,8 @@ | |||
14 | 14 | ||
15 | import os | 15 | import os |
16 | 16 | ||
17 | from command import Command, MirrorSafeCommand | 17 | from command import Command |
18 | from command import MirrorSafeCommand | ||
18 | 19 | ||
19 | 20 | ||
20 | class List(Command, MirrorSafeCommand): | 21 | class List(Command, MirrorSafeCommand): |
diff --git a/subcmds/prune.py b/subcmds/prune.py index 5a68c14a..f18471f3 100644 --- a/subcmds/prune.py +++ b/subcmds/prune.py | |||
@@ -15,7 +15,8 @@ | |||
15 | import itertools | 15 | import itertools |
16 | 16 | ||
17 | from color import Coloring | 17 | from color import Coloring |
18 | from command import DEFAULT_LOCAL_JOBS, PagedCommand | 18 | from command import DEFAULT_LOCAL_JOBS |
19 | from command import PagedCommand | ||
19 | 20 | ||
20 | 21 | ||
21 | class Prune(PagedCommand): | 22 | class Prune(PagedCommand): |
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py index 983fd630..51d963ee 100644 --- a/subcmds/selfupdate.py +++ b/subcmds/selfupdate.py | |||
@@ -15,10 +15,11 @@ | |||
15 | import optparse | 15 | import optparse |
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | from command import Command, MirrorSafeCommand | 18 | from command import Command |
19 | from subcmds.sync import _PostRepoUpgrade | 19 | from command import MirrorSafeCommand |
20 | from subcmds.sync import _PostRepoFetch | ||
21 | from error import RepoExitError | 20 | from error import RepoExitError |
21 | from subcmds.sync import _PostRepoFetch | ||
22 | from subcmds.sync import _PostRepoUpgrade | ||
22 | 23 | ||
23 | 24 | ||
24 | class SelfupdateError(RepoExitError): | 25 | class SelfupdateError(RepoExitError): |
diff --git a/subcmds/start.py b/subcmds/start.py index 481d9ef2..7a42b26c 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
@@ -14,14 +14,15 @@ | |||
14 | 14 | ||
15 | import functools | 15 | import functools |
16 | import sys | 16 | import sys |
17 | from typing import NamedTuple | ||
17 | 18 | ||
18 | from command import Command, DEFAULT_LOCAL_JOBS | 19 | from command import Command |
19 | from git_config import IsImmutable | 20 | from command import DEFAULT_LOCAL_JOBS |
21 | from error import RepoExitError | ||
20 | from git_command import git | 22 | from git_command import git |
23 | from git_config import IsImmutable | ||
21 | from progress import Progress | 24 | from progress import Progress |
22 | from project import Project | 25 | from project import Project |
23 | from typing import NamedTuple | ||
24 | from error import RepoExitError | ||
25 | 26 | ||
26 | 27 | ||
27 | class ExecuteOneResult(NamedTuple): | 28 | class ExecuteOneResult(NamedTuple): |
diff --git a/subcmds/status.py b/subcmds/status.py index 6e0026f9..dac61ab6 100644 --- a/subcmds/status.py +++ b/subcmds/status.py | |||
@@ -17,9 +17,9 @@ import glob | |||
17 | import io | 17 | import io |
18 | import os | 18 | import os |
19 | 19 | ||
20 | from command import DEFAULT_LOCAL_JOBS, PagedCommand | ||
21 | |||
22 | from color import Coloring | 20 | from color import Coloring |
21 | from command import DEFAULT_LOCAL_JOBS | ||
22 | from command import PagedCommand | ||
23 | import platform_utils | 23 | import platform_utils |
24 | 24 | ||
25 | 25 | ||
diff --git a/subcmds/sync.py b/subcmds/sync.py index 74bc4557..13c964b2 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -25,13 +25,14 @@ import socket | |||
25 | import sys | 25 | import sys |
26 | import tempfile | 26 | import tempfile |
27 | import time | 27 | import time |
28 | from typing import NamedTuple, List, Set | 28 | from typing import List, NamedTuple, Set |
29 | import urllib.error | 29 | import urllib.error |
30 | import urllib.parse | 30 | import urllib.parse |
31 | import urllib.request | 31 | import urllib.request |
32 | import xml.parsers.expat | 32 | import xml.parsers.expat |
33 | import xmlrpc.client | 33 | import xmlrpc.client |
34 | 34 | ||
35 | |||
35 | try: | 36 | try: |
36 | import threading as _threading | 37 | import threading as _threading |
37 | except ImportError: | 38 | except ImportError: |
@@ -49,34 +50,35 @@ except ImportError: | |||
49 | return (256, 256) | 50 | return (256, 256) |
50 | 51 | ||
51 | 52 | ||
53 | from command import Command | ||
54 | from command import DEFAULT_LOCAL_JOBS | ||
55 | from command import MirrorSafeCommand | ||
56 | from command import WORKER_BATCH_SIZE | ||
57 | from error import GitError | ||
58 | from error import RepoChangedException | ||
59 | from error import RepoExitError | ||
60 | from error import RepoUnhandledExceptionError | ||
61 | from error import SyncError | ||
62 | from error import UpdateManifestError | ||
52 | import event_log | 63 | import event_log |
53 | from git_command import git_require | 64 | from git_command import git_require |
54 | from git_config import GetUrlCookieFile | 65 | from git_config import GetUrlCookieFile |
55 | from git_refs import R_HEADS, HEAD | 66 | from git_refs import HEAD |
67 | from git_refs import R_HEADS | ||
56 | import git_superproject | 68 | import git_superproject |
69 | import platform_utils | ||
70 | from progress import elapsed_str | ||
71 | from progress import jobs_str | ||
72 | from progress import Progress | ||
73 | from project import DeleteWorktreeError | ||
57 | from project import Project | 74 | from project import Project |
58 | from project import RemoteSpec | 75 | from project import RemoteSpec |
59 | from command import ( | 76 | from project import SyncBuffer |
60 | Command, | ||
61 | DEFAULT_LOCAL_JOBS, | ||
62 | MirrorSafeCommand, | ||
63 | WORKER_BATCH_SIZE, | ||
64 | ) | ||
65 | from error import ( | ||
66 | RepoChangedException, | ||
67 | GitError, | ||
68 | RepoExitError, | ||
69 | SyncError, | ||
70 | UpdateManifestError, | ||
71 | RepoUnhandledExceptionError, | ||
72 | ) | ||
73 | import platform_utils | ||
74 | from project import SyncBuffer, DeleteWorktreeError | ||
75 | from progress import Progress, elapsed_str, jobs_str | ||
76 | from repo_trace import Trace | 77 | from repo_trace import Trace |
77 | import ssh | 78 | import ssh |
78 | from wrapper import Wrapper | 79 | from wrapper import Wrapper |
79 | 80 | ||
81 | |||
80 | _ONE_DAY_S = 24 * 60 * 60 | 82 | _ONE_DAY_S = 24 * 60 * 60 |
81 | 83 | ||
82 | # Env var to implicitly turn auto-gc back on. This was added to allow a user to | 84 | # Env var to implicitly turn auto-gc back on. This was added to allow a user to |
diff --git a/subcmds/upload.py b/subcmds/upload.py index b89525ce..ec89ad43 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -19,9 +19,12 @@ import re | |||
19 | import sys | 19 | import sys |
20 | from typing import List | 20 | from typing import List |
21 | 21 | ||
22 | from command import DEFAULT_LOCAL_JOBS, InteractiveCommand | 22 | from command import DEFAULT_LOCAL_JOBS |
23 | from command import InteractiveCommand | ||
23 | from editor import Editor | 24 | from editor import Editor |
24 | from error import UploadError, SilentRepoExitError, GitError | 25 | from error import GitError |
26 | from error import SilentRepoExitError | ||
27 | from error import UploadError | ||
25 | from git_command import GitCommand | 28 | from git_command import GitCommand |
26 | from git_refs import R_HEADS | 29 | from git_refs import R_HEADS |
27 | from hooks import RepoHook | 30 | from hooks import RepoHook |
diff --git a/subcmds/version.py b/subcmds/version.py index c539db63..71a03608 100644 --- a/subcmds/version.py +++ b/subcmds/version.py | |||
@@ -15,8 +15,11 @@ | |||
15 | import platform | 15 | import platform |
16 | import sys | 16 | import sys |
17 | 17 | ||
18 | from command import Command, MirrorSafeCommand | 18 | from command import Command |
19 | from git_command import git, RepoSourceVersion, user_agent | 19 | from command import MirrorSafeCommand |
20 | from git_command import git | ||
21 | from git_command import RepoSourceVersion | ||
22 | from git_command import user_agent | ||
20 | from git_refs import HEAD | 23 | from git_refs import HEAD |
21 | from wrapper import Wrapper | 24 | from wrapper import Wrapper |
22 | 25 | ||
diff --git a/tests/test_error.py b/tests/test_error.py index 2b28f5c2..a74ed2d7 100644 --- a/tests/test_error.py +++ b/tests/test_error.py | |||
@@ -18,13 +18,14 @@ import inspect | |||
18 | import pickle | 18 | import pickle |
19 | import unittest | 19 | import unittest |
20 | 20 | ||
21 | import command | ||
21 | import error | 22 | import error |
22 | import project | ||
23 | import git_command | ||
24 | import fetch | 23 | import fetch |
25 | import command | 24 | import git_command |
25 | import project | ||
26 | from subcmds import all_modules | 26 | from subcmds import all_modules |
27 | 27 | ||
28 | |||
28 | imports = all_modules + [ | 29 | imports = all_modules + [ |
29 | error, | 30 | error, |
30 | project, | 31 | project, |
diff --git a/tests/test_git_command.py b/tests/test_git_command.py index 3dd31b29..c803d280 100644 --- a/tests/test_git_command.py +++ b/tests/test_git_command.py | |||
@@ -14,11 +14,12 @@ | |||
14 | 14 | ||
15 | """Unittests for the git_command.py module.""" | 15 | """Unittests for the git_command.py module.""" |
16 | 16 | ||
17 | import re | ||
18 | import os | 17 | import os |
18 | import re | ||
19 | import subprocess | 19 | import subprocess |
20 | import unittest | 20 | import unittest |
21 | 21 | ||
22 | |||
22 | try: | 23 | try: |
23 | from unittest import mock | 24 | from unittest import mock |
24 | except ImportError: | 25 | except ImportError: |
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index eb542c60..f884f507 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py | |||
@@ -21,10 +21,11 @@ import tempfile | |||
21 | import unittest | 21 | import unittest |
22 | from unittest import mock | 22 | from unittest import mock |
23 | 23 | ||
24 | from test_manifest_xml import sort_attributes | ||
25 | |||
24 | import git_superproject | 26 | import git_superproject |
25 | import git_trace2_event_log | 27 | import git_trace2_event_log |
26 | import manifest_xml | 28 | import manifest_xml |
27 | from test_manifest_xml import sort_attributes | ||
28 | 29 | ||
29 | 30 | ||
30 | class SuperprojectTestCase(unittest.TestCase): | 31 | class SuperprojectTestCase(unittest.TestCase): |
diff --git a/tests/test_hooks.py b/tests/test_hooks.py index 78277128..76e928f7 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py | |||
@@ -14,9 +14,10 @@ | |||
14 | 14 | ||
15 | """Unittests for the hooks.py module.""" | 15 | """Unittests for the hooks.py module.""" |
16 | 16 | ||
17 | import hooks | ||
18 | import unittest | 17 | import unittest |
19 | 18 | ||
19 | import hooks | ||
20 | |||
20 | 21 | ||
21 | class RepoHookShebang(unittest.TestCase): | 22 | class RepoHookShebang(unittest.TestCase): |
22 | """Check shebang parsing in RepoHook.""" | 23 | """Check shebang parsing in RepoHook.""" |
diff --git a/tests/test_project.py b/tests/test_project.py index bc8330b2..79728d70 100644 --- a/tests/test_project.py +++ b/tests/test_project.py | |||
@@ -22,9 +22,9 @@ import tempfile | |||
22 | import unittest | 22 | import unittest |
23 | 23 | ||
24 | import error | 24 | import error |
25 | import manifest_xml | ||
26 | import git_command | 25 | import git_command |
27 | import git_config | 26 | import git_config |
27 | import manifest_xml | ||
28 | import platform_utils | 28 | import platform_utils |
29 | import project | 29 | import project |
30 | 30 | ||
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index 71b0f8e0..b9f0a746 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py | |||
@@ -16,16 +16,17 @@ | |||
16 | import os | 16 | import os |
17 | import shutil | 17 | import shutil |
18 | import tempfile | 18 | import tempfile |
19 | import unittest | ||
20 | import time | 19 | import time |
20 | import unittest | ||
21 | from unittest import mock | 21 | from unittest import mock |
22 | 22 | ||
23 | import pytest | 23 | import pytest |
24 | 24 | ||
25 | import command | 25 | import command |
26 | from subcmds import sync | 26 | from error import GitError |
27 | from error import RepoExitError | ||
27 | from project import SyncNetworkHalfResult | 28 | from project import SyncNetworkHalfResult |
28 | from error import GitError, RepoExitError | 29 | from subcmds import sync |
29 | 30 | ||
30 | 31 | ||
31 | @pytest.mark.parametrize( | 32 | @pytest.mark.parametrize( |
diff --git a/tests/test_subcmds_upload.py b/tests/test_subcmds_upload.py index 75811996..cd888977 100644 --- a/tests/test_subcmds_upload.py +++ b/tests/test_subcmds_upload.py | |||
@@ -17,8 +17,9 @@ | |||
17 | import unittest | 17 | import unittest |
18 | from unittest import mock | 18 | from unittest import mock |
19 | 19 | ||
20 | from error import GitError | ||
21 | from error import UploadError | ||
20 | from subcmds import upload | 22 | from subcmds import upload |
21 | from error import UploadError, GitError | ||
22 | 23 | ||
23 | 24 | ||
24 | class UnexpectedError(Exception): | 25 | class UnexpectedError(Exception): |