diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2021-05-24 23:53:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-24 23:53:38 -0400 |
| commit | 21cdab4babfbd0363052dcaea06455c80911024b (patch) | |
| tree | 3ae4563829ad0324dedcd3e40115dd5c2b13a156 | |
| parent | d24f1ad429aab3beb15968d34d77ef757ca4ea6e (diff) | |
| parent | 7eae4586ae90dc0222610c1a1ed7145612d36705 (diff) | |
| download | cmd2-git-21cdab4babfbd0363052dcaea06455c80911024b.tar.gz | |
Merge pull request #1105 from srowe/make-run_editor-public
Make _run_editor() public
| -rw-r--r-- | cmd2/cmd2.py | 6 | ||||
| -rwxr-xr-x | tests/test_history.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 77f20b71..0916c288 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -4389,7 +4389,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: @@ -4632,9 +4632,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') |
