mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-11-13 15:57:35 +00:00
style: use import command in unittests
Align with Google style guides and `import command` as a module rather than import symbols out of it in the tests tree. Change-Id: I5c151d22c9ed8f8c7ea762823c8b2e25225a2ac4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/654819 Commit-Queue: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Brian Gan <brgan@google.com>
This commit is contained in:
1 parent
d7c431b996
commit
eb668be30d
3 files changed
+12
-14
No files matched your search
@@ -44,10 +44,8 @@ per-file-ignores =
|
||||
tests/e2e/test_partial_clone.py: IMR241,
|
||||
tests/e2e/test_sync_modes.py: IMR241,
|
||||
tests/e2e/test_workflows.py: IMR241,
|
||||
tests/test_command.py: IMR241,
|
||||
tests/test_error.py: IMR241,
|
||||
tests/test_main.py: IMR241,
|
||||
tests/test_subcmds.py: IMR241,
|
||||
tests/test_subcmds_sync.py: IMR241,
|
||||
extend-ignore =
|
||||
# E203: Whitespace before ':'
|
||||
|
||||
@@ -18,7 +18,7 @@ from typing import Iterable, List, Optional
|
||||
|
||||
import pytest
|
||||
|
||||
from command import Command
|
||||
import command
|
||||
|
||||
|
||||
class FakeProject:
|
||||
@@ -136,7 +136,7 @@ def test_get_projects_keeps_derived_subprojects_for_repeated_repo():
|
||||
sync_s=True,
|
||||
)
|
||||
manifest = FakeManifest([project_a, project_b])
|
||||
cmd = Command(manifest=manifest)
|
||||
cmd = command.Command(manifest=manifest)
|
||||
|
||||
projects = cmd.GetProjects([])
|
||||
|
||||
@@ -165,7 +165,7 @@ def test_get_projects_submodule_override(
|
||||
derived_subprojects=[submodule],
|
||||
sync_s=sync_s,
|
||||
)
|
||||
cmd = Command(manifest=FakeManifest([project]))
|
||||
cmd = command.Command(manifest=FakeManifest([project]))
|
||||
|
||||
projects = cmd.GetProjects([], submodules_ok=submodules_ok)
|
||||
|
||||
@@ -214,7 +214,7 @@ def test_get_projects_uses_groups_from_each_manifest_unless_overridden(
|
||||
all_projects=[outer_project, *child_manifest.projects],
|
||||
effective_groups="outer-group",
|
||||
)
|
||||
cmd = Command(manifest=outer_manifest)
|
||||
cmd = command.Command(manifest=outer_manifest)
|
||||
|
||||
projects = cmd.GetProjects(
|
||||
[],
|
||||
@@ -248,7 +248,7 @@ def test_get_projects_by_name_uses_groups_from_each_manifest() -> None:
|
||||
all_projects=[outer_project, *child_manifest.projects],
|
||||
effective_groups="outer-group",
|
||||
)
|
||||
cmd = Command(manifest=outer_manifest)
|
||||
cmd = command.Command(manifest=outer_manifest)
|
||||
|
||||
projects = cmd.GetProjects(
|
||||
["shared"],
|
||||
@@ -296,7 +296,7 @@ def test_find_projects_uses_groups_from_each_manifest() -> None:
|
||||
)
|
||||
outer_manifest.outer_client = outer_manifest
|
||||
|
||||
cmd = Command(manifest=outer_manifest)
|
||||
cmd = command.Command(manifest=outer_manifest)
|
||||
|
||||
projects = cmd.FindProjects(["match"], all_manifests=True)
|
||||
|
||||
@@ -322,7 +322,7 @@ def test_find_projects_uses_explicit_groups() -> None:
|
||||
[default_project, override_project],
|
||||
effective_groups="default-group",
|
||||
)
|
||||
cmd = Command(manifest=manifest)
|
||||
cmd = command.Command(manifest=manifest)
|
||||
|
||||
projects = cmd.FindProjects(
|
||||
["override"],
|
||||
@@ -339,7 +339,7 @@ def test_find_projects_allows_missing_projects() -> None:
|
||||
"missing",
|
||||
exists=False,
|
||||
)
|
||||
cmd = Command(manifest=FakeManifest([project]))
|
||||
cmd = command.Command(manifest=FakeManifest([project]))
|
||||
|
||||
projects = cmd.FindProjects(
|
||||
["missing"],
|
||||
|
||||
@@ -19,7 +19,7 @@ from typing import Type
|
||||
|
||||
import pytest
|
||||
|
||||
from command import Command
|
||||
import command
|
||||
import subcmds
|
||||
from subcmds import sync
|
||||
|
||||
@@ -49,7 +49,7 @@ def test_naming(name: str) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, cls", subcmds.all_commands.items())
|
||||
def test_help_desc_style(name: str, cls: Type[Command]) -> None:
|
||||
def test_help_desc_style(name: str, cls: Type[command.Command]) -> None:
|
||||
"""Force some consistency in option descriptions.
|
||||
|
||||
Python's optparse & argparse has a few default options like --help.
|
||||
@@ -79,7 +79,7 @@ def test_help_desc_style(name: str, cls: Type[Command]) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, cls", subcmds.all_commands.items())
|
||||
def test_cli_option_style(name: str, cls: Type[Command]) -> None:
|
||||
def test_cli_option_style(name: str, cls: Type[command.Command]) -> None:
|
||||
"""Force some consistency in option flags."""
|
||||
cmd = cls()
|
||||
parser = cmd.OptionParser
|
||||
@@ -142,7 +142,7 @@ def test_cli_option_dest() -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, cls", subcmds.all_commands.items())
|
||||
def test_common_validate_options(name: str, cls: Type[Command]) -> None:
|
||||
def test_common_validate_options(name: str, cls: Type[command.Command]) -> None:
|
||||
"""Verify CommonValidateOptions sets up expected fields."""
|
||||
cmd = cls()
|
||||
opts, args = cmd.OptionParser.parse_args([])
|
||||
|
||||
Reference in new issue
Block a user