Show More
@@ -202,7 +202,7 b' class ScriptMagics(Magics):' | |||
|
202 | 202 | asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) |
|
203 | 203 | loop = asyncio.get_event_loop() |
|
204 | 204 | |
|
205 |
argv = arg_split(line, posix=not sys.platform.startswith( |
|
|
205 | argv = arg_split(line, posix=not sys.platform.startswith("win")) | |
|
206 | 206 | args, cmd = self.shebang.parser.parse_known_args(argv) |
|
207 | 207 | try: |
|
208 | 208 | p = loop.run_until_complete( |
@@ -263,7 +263,6 b' class ScriptMagics(Magics):' | |||
|
263 | 263 | % (p.pid, e)) |
|
264 | 264 | return |
|
265 | 265 | if args.raise_error and p.returncode!=0: |
|
266 | print(p.returncode) | |
|
267 | 266 | raise CalledProcessError(p.returncode, cell) |
|
268 | 267 | |
|
269 | 268 | def _run_script(self, p, cell, to_close): |
@@ -951,25 +951,29 b' def test_script_out_err():' | |||
|
951 | 951 | async def test_script_bg_out(): |
|
952 | 952 | ip = get_ipython() |
|
953 | 953 | ip.run_cell_magic("script", "--bg --out output sh", "echo 'hi'") |
|
954 | ||
|
955 | nt.assert_equal((await ip.user_ns['output'].read()), b'hi\n') | |
|
954 | nt.assert_equal((await ip.user_ns["output"].read()), b"hi\n") | |
|
956 | 955 | ip.user_ns['output'].close() |
|
957 | 956 | |
|
957 | ||
|
958 | 958 | @dec.skip_win32 |
|
959 | 959 | async def test_script_bg_err(): |
|
960 | 960 | ip = get_ipython() |
|
961 | 961 | ip.run_cell_magic("script", "--bg --err error sh", "echo 'hello' >&2") |
|
962 |
nt.assert_equal((await ip.user_ns[ |
|
|
963 |
ip.user_ns[ |
|
|
962 | nt.assert_equal((await ip.user_ns["error"].read()), b"hello\n") | |
|
963 | ip.user_ns["error"].close() | |
|
964 | ||
|
964 | 965 | |
|
965 | 966 | @dec.skip_win32 |
|
966 | 967 | async def test_script_bg_out_err(): |
|
967 | 968 | ip = get_ipython() |
|
968 | ip.run_cell_magic("script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2") | |
|
969 | nt.assert_equal((await ip.user_ns['output'].read()), b'hi\n') | |
|
970 | nt.assert_equal((await ip.user_ns['error'].read()), b'hello\n') | |
|
971 | ip.user_ns['output'].close() | |
|
972 | ip.user_ns['error'].close() | |
|
969 | ip.run_cell_magic( | |
|
970 | "script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2" | |
|
971 | ) | |
|
972 | nt.assert_equal((await ip.user_ns["output"].read()), b"hi\n") | |
|
973 | nt.assert_equal((await ip.user_ns["error"].read()), b"hello\n") | |
|
974 | ip.user_ns["output"].close() | |
|
975 | ip.user_ns["error"].close() | |
|
976 | ||
|
973 | 977 | |
|
974 | 978 | def test_script_defaults(): |
|
975 | 979 | ip = get_ipython() |
General Comments 0
You need to be logged in to leave comments.
Login now