test that `IPython.embed()` works
()
| 39 | _exit = b"exit\r" |
| 40 | |
| 41 | def test_ipython_embed(): |
| 42 | """test that `IPython.embed()` works""" |
| 43 | with NamedFileInTemporaryDirectory('file_with_embed.py') as f: |
| 44 | f.write(_sample_embed) |
| 45 | f.flush() |
| 46 | f.close() # otherwise msft won't be able to read the file |
| 47 | |
| 48 | # run `python file_with_embed.py` |
| 49 | cmd = [sys.executable, f.name] |
| 50 | env = os.environ.copy() |
| 51 | env['IPY_TEST_SIMPLE_PROMPT'] = '1' |
| 52 | |
| 53 | p = subprocess.Popen(cmd, env=env, stdin=subprocess.PIPE, |
| 54 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
| 55 | out, err = p.communicate(_exit) |
| 56 | std = out.decode('UTF-8') |
| 57 | |
| 58 | nt.assert_equal(p.returncode, 0) |
| 59 | nt.assert_in('3 . 14', std) |
| 60 | if os.name != 'nt': |
| 61 | # TODO: Fix up our different stdout references, see issue gh-14 |
| 62 | nt.assert_in('IPython', std) |
| 63 | nt.assert_in('bye!', std) |
| 64 | |
| 65 | @skip_win32 |
| 66 | def test_nest_embed(): |
nothing calls this directly
no test coverage detected