Skip to content

Commit f69b255

Browse files
committed
Fixed unit test that was hanging on Windows
1 parent 163dcad commit f69b255

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/test_cmd2.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ def test_edit_file(base_app, request, monkeypatch):
882882
# Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
883883
base_app.editor = 'fooedit'
884884

885-
# Mock out the os.system call so we don't actually open an editor
885+
# Mock out the subprocess.Popen call so we don't actually open an editor
886886
m = mock.MagicMock(name='Popen')
887887
monkeypatch.setattr("subprocess.Popen", m)
888888

@@ -936,9 +936,12 @@ def test_base_py_interactive(base_app):
936936

937937

938938
def test_exclude_from_history(base_app, monkeypatch):
939-
# Mock out the os.system call so we don't actually open an editor
940-
m = mock.MagicMock(name='system')
941-
monkeypatch.setattr("os.system", m)
939+
# Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
940+
base_app.editor = 'fooedit'
941+
942+
# Mock out the subprocess.Popen call so we don't actually open an editor
943+
m = mock.MagicMock(name='Popen')
944+
monkeypatch.setattr("subprocess.Popen", m)
942945

943946
# Run edit command
944947
run_cmd(base_app, 'edit')
@@ -952,6 +955,7 @@ def test_exclude_from_history(base_app, monkeypatch):
952955

953956
# Now run a command which isn't excluded from the history
954957
run_cmd(base_app, 'help')
958+
955959
# And verify we have a history now ...
956960
out = run_cmd(base_app, 'history')
957961
expected = normalize("""-------------------------[1]

0 commit comments

Comments
 (0)