Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c58e886

Browse files
committed
Fix the test on Windows
1 parent 8d565d9 commit c58e886

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test_magic.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ def print_numbers():
14241424
thread = Thread(target=print_numbers)
14251425
thread.start()
14261426
sleep(step / 2)
1427-
ip.run_cell_magic("script", f"{sys.executable}", code)
1427+
ip.run_cell_magic("script", sys.executable, code)
14281428
thread.join()
14291429

14301430
captured = capsys.readouterr()
@@ -1437,7 +1437,12 @@ def test_script_streams_multibyte_unicode(capsys):
14371437
ip = get_ipython()
14381438
# € in UTF-8 is encoded using 3 bytes
14391439
code = "print('€' * 1000, end='')"
1440-
ip.run_cell_magic("script", f"{sys.executable}", code)
1440+
is_windows = os.name == "nt"
1441+
command = sys.executable
1442+
if is_windows:
1443+
# windows does not use UTF for streams/pipes by default
1444+
command += " -X utf8"
1445+
ip.run_cell_magic("script", command, code)
14411446

14421447
captured = capsys.readouterr()
14431448
assert captured.out == "€" * 1000

0 commit comments

Comments
 (0)