Skip to content

Commit 21cdab4

Browse files
authored
Merge pull request #1105 from srowe/make-run_editor-public
Make _run_editor() public
2 parents d24f1ad + 7eae458 commit 21cdab4

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
@@ -4389,7 +4389,7 @@ def do_history(self, args: argparse.Namespace) -> Optional[bool]:
43894389
else:
43904390
fobj.write(f'{command.raw}\n')
43914391
try:
4392-
self._run_editor(fname)
4392+
self.run_editor(fname)
43934393
# noinspection PyTypeChecker
43944394
self.do_run_script(utils.quote_string(fname))
43954395
finally:
@@ -4632,9 +4632,9 @@ def _generate_transcript(self, history: Union[List[HistoryItem], List[str]], tra
46324632
@with_argparser(edit_parser)
46334633
def do_edit(self, args: argparse.Namespace) -> None:
46344634
"""Run a text editor and optionally open a file with it"""
4635-
self._run_editor(args.file_path)
4635+
self.run_editor(args.file_path)
46364636

4637-
def _run_editor(self, file_path: Optional[str]) -> None:
4637+
def run_editor(self, file_path: Optional[str]) -> None:
46384638
"""
46394639
Run a text editor and optionally open a file with it
46404640

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)