##// END OF EJS Templates
py3compat fixes for %%script and tests
MinRK -
Show More
@@ -186,6 +186,7 b' class ScriptMagics(Magics, Configurable):'
186 186
187 187 p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE)
188 188
189 cell = cell.encode('utf8', 'replace')
189 190 if args.bg:
190 191 if args.out:
191 192 self.shell.user_ns[args.out] = p.stdout
@@ -638,20 +638,20 b' def test_script_out_err():'
638 638 def test_script_bg_out():
639 639 ip = get_ipython()
640 640 ip.run_cell_magic("script", "--bg --out output sh", "echo 'hi'")
641 nt.assert_equals(ip.user_ns['output'].read(), 'hi\n')
641 nt.assert_equals(ip.user_ns['output'].read(), b'hi\n')
642 642
643 643 @dec.skip_win32
644 644 def test_script_bg_err():
645 645 ip = get_ipython()
646 646 ip.run_cell_magic("script", "--bg --err error sh", "echo 'hello' >&2")
647 nt.assert_equals(ip.user_ns['error'].read(), 'hello\n')
647 nt.assert_equals(ip.user_ns['error'].read(), b'hello\n')
648 648
649 649 @dec.skip_win32
650 650 def test_script_bg_out_err():
651 651 ip = get_ipython()
652 652 ip.run_cell_magic("script", "--bg --out output --err error sh", "echo 'hi'\necho 'hello' >&2")
653 nt.assert_equals(ip.user_ns['output'].read(), 'hi\n')
654 nt.assert_equals(ip.user_ns['error'].read(), 'hello\n')
653 nt.assert_equals(ip.user_ns['output'].read(), b'hi\n')
654 nt.assert_equals(ip.user_ns['error'].read(), b'hello\n')
655 655
656 656 def test_script_defaults():
657 657 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now