summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon J. Rowe <srowe@mose.org.uk>2021-05-14 19:40:18 +0100
committerSimon J. Rowe <srowe@mose.org.uk>2021-05-14 19:40:18 +0100
commit9068f140998a4bab4a3ba9b75f879ca726f029f7 (patch)
tree79cf98c55a0baaa73d1d65333015fa3b822aa1f6
parent79bf87d1e333ea5fe0dfeb61c707eb9bddfd0255 (diff)
downloadcmd2-git-9068f140998a4bab4a3ba9b75f879ca726f029f7.tar.gz
Make _run_editor() public
-rw-r--r--cmd2/cmd2.py6
-rwxr-xr-xtests/test_history.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 418f8a4f..98b4db54 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -4384,7 +4384,7 @@ class Cmd(cmd.Cmd):
else:
fobj.write(f'{command.raw}\n')
try:
- self._run_editor(fname)
+ self.run_editor(fname)
# noinspection PyTypeChecker
self.do_run_script(utils.quote_string(fname))
finally:
@@ -4627,9 +4627,9 @@ class Cmd(cmd.Cmd):
@with_argparser(edit_parser)
def do_edit(self, args: argparse.Namespace) -> None:
"""Run a text editor and optionally open a file with it"""
- self._run_editor(args.file_path)
+ self.run_editor(args.file_path)
- def _run_editor(self, file_path: Optional[str]) -> None:
+ def run_editor(self, file_path: Optional[str]) -> None:
"""
Run a text editor and optionally open a file with it
diff --git a/tests/test_history.py b/tests/test_history.py
index d1285705..bb857334 100755
--- a/tests/test_history.py
+++ b/tests/test_history.py
@@ -544,9 +544,9 @@ def test_history_edit(monkeypatch):
# going to call it due to the mock
app.editor = 'fooedit'
- # Mock out the _run_editor call so we don't actually open an editor
- edit_mock = mock.MagicMock(name='_run_editor')
- monkeypatch.setattr("cmd2.Cmd._run_editor", edit_mock)
+ # Mock out the run_editor call so we don't actually open an editor
+ edit_mock = mock.MagicMock(name='run_editor')
+ monkeypatch.setattr("cmd2.Cmd.run_editor", edit_mock)
# Mock out the run_script call since the mocked edit won't produce a file
run_script_mock = mock.MagicMock(name='do_run_script')