diff --git a/.flake8 b/.flake8 index 9e5761cf2..e1c9d1486 100644 --- a/.flake8 +++ b/.flake8 @@ -50,7 +50,6 @@ per-file-ignores = tests/e2e/test_sync_modes.py: IMR241, tests/e2e/test_workflows.py: IMR241, tests/test_command.py: IMR241, - tests/test_editor.py: IMR241, tests/test_error.py: IMR241, tests/test_main.py: IMR241, tests/test_repo_logging.py: IMR241, diff --git a/main.py b/main.py index 8f5cf32b0..48a679527 100755 --- a/main.py +++ b/main.py @@ -44,7 +44,7 @@ except ImportError: from color import SetDefaultColoring from command import InteractiveCommand from command import MirrorSafeCommand -from editor import Editor +import editor import error import event_log import git_command @@ -417,7 +417,7 @@ class _Repo: ) cmd.event_log.enabled = bool(gopts.event_log) - Editor.globalConfig = cmd.client.globalConfig + editor.Editor.globalConfig = cmd.client.globalConfig if not isinstance(cmd, MirrorSafeCommand) and cmd.manifest.IsMirror: logger.error("fatal: '%s' requires a working directory", name) diff --git a/subcmds/upload.py b/subcmds/upload.py index 248486979..55b073db5 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -21,7 +21,7 @@ from typing import List from command import DEFAULT_LOCAL_JOBS from command import InteractiveCommand -from editor import Editor +import editor import error import git_refs import git_superproject @@ -494,7 +494,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ branches[project_path] = b script.append("") - script = Editor.EditString("\n".join(script)).split("\n") + script = editor.Editor.EditString("\n".join(script)).split("\n") project_re = re.compile(r"^#?\s*project\s*([^\s]+)/:$") branch_re = re.compile(r"^\s*branch\s*([^\s(]+)\s*\(.*") diff --git a/tests/test_editor.py b/tests/test_editor.py index d51765dd1..f7a37fef8 100644 --- a/tests/test_editor.py +++ b/tests/test_editor.py @@ -16,30 +16,30 @@ import pytest -from editor import Editor +import editor @pytest.fixture(autouse=True) def reset_editor() -> None: """Take care of resetting Editor state across tests.""" - Editor._editor = None + editor.Editor._editor = None yield - Editor._editor = None + editor.Editor._editor = None def test_basic() -> None: """Basic checking of _GetEditor.""" - Editor._editor = ":" - assert Editor._GetEditor() == ":" + editor.Editor._editor = ":" + assert editor.Editor._GetEditor() == ":" def test_no_editor() -> None: """Check behavior when no editor is available.""" - Editor._editor = ":" - assert Editor.EditString("foo") == "foo" + editor.Editor._editor = ":" + assert editor.Editor.EditString("foo") == "foo" def test_cat_editor() -> None: """Check behavior when editor is `cat`.""" - Editor._editor = "cat" - assert Editor.EditString("foo") == "foo" + editor.Editor._editor = "cat" + assert editor.Editor.EditString("foo") == "foo"