Skip to content

Commit 21fef66

Browse files
committed
Fix test failures on Windows when path contains spaces and unicode chars.
1 parent 416fccc commit 21fef66

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

test/test_core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6314,9 +6314,12 @@ def test_unicode_js_library(self):
63146314
# are having the desired effect.
63156315
# This means that files open()'d by emscripten without an explicit encoding will
63166316
# cause this test to file, hopefully catching any places where we forget to do this.
6317-
create_file('expect_fail.py', 'print(len(open(r"%s").read()))' % test_file('unicode_library.js'))
6318-
err = self.expect_fail([PYTHON, 'expect_fail.py'], expect_traceback=True)
6319-
self.assertContained('UnicodeDecodeError', err)
6317+
6318+
# On Windows when Unicode support is enabled, this test code does not fail.
6319+
if not (WINDOWS and self.run_process(['chcp'], stdout=PIPE, shell=True).stdout.strip() == 'Active code page: 65001'):
6320+
create_file('expect_fail.py', 'print(len(open(r"%s").read()))' % test_file('unicode_library.js'))
6321+
err = self.expect_fail([PYTHON, 'expect_fail.py'], expect_traceback=True)
6322+
self.assertContained('UnicodeDecodeError', err)
63206323

63216324
self.emcc_args += ['-sMODULARIZE', '--js-library', test_file('unicode_library.js'), '--extern-post-js', test_file('modularize_post_js.js'), '--post-js', test_file('unicode_postjs.js')]
63226325
self.do_run_in_out_file_test('test_unicode_js_library.c')

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15312,7 +15312,7 @@ def test_node_pthreads_err_out(self):
1531215312
@only_windows('This test verifies Windows batch script behavior against bug https://github.com/microsoft/terminal/issues/15212')
1531315313
@with_env_modify({'PATH': path_from_root() + os.pathsep + os.getenv('PATH')})
1531415314
def test_windows_batch_file_dp0_expansion_bug(self):
15315-
create_file('build_with_quotes.bat', f'@"emcc" {test_file("hello_world.c")}')
15315+
create_file('build_with_quotes.bat', f'@"emcc" "{test_file("hello_world.c")}"')
1531615316
self.run_process(['build_with_quotes.bat'])
1531715317

1531815318
@only_windows('Check that directory permissions are properly retrieved on Windows')

0 commit comments

Comments
 (0)