Skip to content

Commit 9068f14

Browse files
committed
Make _run_editor() public
1 parent 79bf87d commit 9068f14

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd2/cmd2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,7 +4384,7 @@ def do_history(self, args: argparse.Namespace) -> Optional[bool]:
43844384
else:
43854385
fobj.write(f'{command.raw}\n')
43864386
try:
4387-
self._run_editor(fname)
4387+
self.run_editor(fname)
43884388
# noinspection PyTypeChecker
43894389
self.do_run_script(utils.quote_string(fname))
43904390
finally:
@@ -4627,9 +4627,9 @@ def _generate_transcript(self, history: Union[List[HistoryItem], List[str]], tra
46274627
@with_argparser(edit_parser)
46284628
def do_edit(self, args: argparse.Namespace) -> None:
46294629
"""Run a text editor and optionally open a file with it"""
4630-
self._run_editor(args.file_path)
4630+
self.run_editor(args.file_path)
46314631

4632-
def _run_editor(self, file_path: Optional[str]) -> None:
4632+
def run_editor(self, file_path: Optional[str]) -> None:
46334633
"""
46344634
Run a text editor and optionally open a file with it
46354635

tests/test_history.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ def test_history_edit(monkeypatch):
544544
# going to call it due to the mock
545545
app.editor = 'fooedit'
546546

547-
# Mock out the _run_editor call so we don't actually open an editor
548-
edit_mock = mock.MagicMock(name='_run_editor')
549-
monkeypatch.setattr("cmd2.Cmd._run_editor", edit_mock)
547+
# Mock out the run_editor call so we don't actually open an editor
548+
edit_mock = mock.MagicMock(name='run_editor')
549+
monkeypatch.setattr("cmd2.Cmd.run_editor", edit_mock)
550550

551551
# Mock out the run_script call since the mocked edit won't produce a file
552552
run_script_mock = mock.MagicMock(name='do_run_script')

0 commit comments

Comments
 (0)