MCPcopy Create free account
hub / github.com/ipython/ipython / test_install_editor

Function test_install_editor

IPython/lib/tests/test_editorhooks.py:10–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8from IPython.lib import editorhooks
9
10def test_install_editor():
11 called = []
12 def fake_popen(*args, **kwargs):
13 called.append({
14 'args': args,
15 'kwargs': kwargs,
16 })
17 return mock.MagicMock(**{'wait.return_value': 0})
18 editorhooks.install_editor('foo -l {line} -f {filename}', wait=False)
19
20 with mock.patch('subprocess.Popen', fake_popen):
21 get_ipython().hooks.editor('the file', 64)
22
23 nt.assert_equal(len(called), 1)
24 args = called[0]['args']
25 kwargs = called[0]['kwargs']
26
27 nt.assert_equal(kwargs, {'shell': True})
28
29 if sys.platform.startswith('win'):
30 expected = ['foo', '-l', '64', '-f', 'the file']
31 else:
32 expected = "foo -l 64 -f 'the file'"
33 cmd = args[0]
34 nt.assert_equal(cmd, expected)

Callers

nothing calls this directly

Calls 1

get_ipythonFunction · 0.90

Tested by

no test coverage detected