Skip to content

Commit 40b03a5

Browse files
committed
Fixed unit test which was slow on macOS and hung forever on Windows
1 parent eecd1c5 commit 40b03a5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_history.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ def test_base_help_history(base_app):
2626
assert out == normalize(HELP_HISTORY)
2727

2828
def test_exclude_from_history(base_app, monkeypatch):
29-
# Mock out the os.system call so we don't actually open an editor
30-
m = mock.MagicMock(name='system')
31-
monkeypatch.setattr("os.system", m)
29+
# Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
30+
base_app.editor = 'fooedit'
31+
32+
# Mock out the subprocess.Popen call so we don't actually open an editor
33+
m = mock.MagicMock(name='Popen')
34+
monkeypatch.setattr("subprocess.Popen", m)
3235

3336
# Run edit command
3437
run_cmd(base_app, 'edit')
@@ -42,6 +45,7 @@ def test_exclude_from_history(base_app, monkeypatch):
4245

4346
# Now run a command which isn't excluded from the history
4447
run_cmd(base_app, 'help')
48+
4549
# And verify we have a history now ...
4650
out = run_cmd(base_app, 'history')
4751
expected = normalize(""" 1 help""")

0 commit comments

Comments
 (0)