diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-02-22 00:12:02 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-02-22 00:12:02 -0500 |
commit | f69b2558389f96e14a2150c656d59e9df349a670 (patch) | |
tree | dccef740907feff7f12c6a4ca058855bf931a264 /tests/test_cmd2.py | |
parent | 163dcad22375eb84ecd8de311c344a9b6630c685 (diff) | |
download | cmd2-git-f69b2558389f96e14a2150c656d59e9df349a670.tar.gz |
Fixed unit test that was hanging on Windows
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 8b6035bd..faef21f9 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -882,7 +882,7 @@ def test_edit_file(base_app, request, monkeypatch): # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock base_app.editor = 'fooedit' - # Mock out the os.system call so we don't actually open an editor + # Mock out the subprocess.Popen call so we don't actually open an editor m = mock.MagicMock(name='Popen') monkeypatch.setattr("subprocess.Popen", m) @@ -936,9 +936,12 @@ def test_base_py_interactive(base_app): def test_exclude_from_history(base_app, monkeypatch): - # Mock out the os.system call so we don't actually open an editor - m = mock.MagicMock(name='system') - monkeypatch.setattr("os.system", m) + # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock + base_app.editor = 'fooedit' + + # Mock out the subprocess.Popen call so we don't actually open an editor + m = mock.MagicMock(name='Popen') + monkeypatch.setattr("subprocess.Popen", m) # Run edit command run_cmd(base_app, 'edit') @@ -952,6 +955,7 @@ def test_exclude_from_history(base_app, monkeypatch): # Now run a command which isn't excluded from the history run_cmd(base_app, 'help') + # And verify we have a history now ... out = run_cmd(base_app, 'history') expected = normalize("""-------------------------[1] |