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