diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-02-26 22:54:31 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-02-26 22:54:31 -0500 |
commit | 40b03a52fb72895cb0b6651de567ff3a3d868405 (patch) | |
tree | a8d1454ea820ea5950ee0b3af33509092ef9d2fe /tests | |
parent | eecd1c54a3e731cc38900eab7bca62444eb67279 (diff) | |
download | cmd2-git-40b03a52fb72895cb0b6651de567ff3a3d868405.tar.gz |
Fixed unit test which was slow on macOS and hung forever on Windows
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_history.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/test_history.py b/tests/test_history.py index 60ffdb3a..b6dc66a2 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -26,9 +26,12 @@ def test_base_help_history(base_app): assert out == normalize(HELP_HISTORY) 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') @@ -42,6 +45,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 help""") |