Skip to content

Commit 1a245fa

Browse files
committed
add test_py_default_with_valid_bom and mark as expected failure
until pythonGH-99620 is fixed
1 parent 1861cc2 commit 1a245fa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Lib/test/test_launcher.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ def __enter__(self):
157157
self._preserved = self.path.read_bytes()
158158
except FileNotFoundError:
159159
self._preserved = None
160-
self.path.write_text(self.content, encoding="utf-16")
160+
if isinstance(self.content, bytes):
161+
self.path.write_bytes(self.content)
162+
else:
163+
self.path.write_text(self.content, encoding="utf-16")
161164

162165
def __exit__(self, *exc_info):
163166
if self._preserved is None:
@@ -472,6 +475,15 @@ def test_py_default(self):
472475
self.assertEqual("3.100", data["SearchInfo.tag"])
473476
self.assertEqual("X.Y.exe -arg", data["stdout"].strip())
474477

478+
@unittest.expectedFailure # fails until GH-99620 is fixed
479+
def test_py_default_with_valid_bom(self):
480+
content = TEST_PY_DEFAULTS.encode("utf-8")
481+
with self.py_ini(b"\xEF\xBB\xBF" + content):
482+
data = self.run_py(["-arg"])
483+
self.assertEqual("PythonTestSuite", data["SearchInfo.company"])
484+
self.assertEqual("3.100", data["SearchInfo.tag"])
485+
self.assertEqual("X.Y.exe -arg", data["stdout"].strip())
486+
475487
def test_py2_default(self):
476488
with self.py_ini(TEST_PY_DEFAULTS):
477489
data = self.run_py(["-2", "-arg"])

0 commit comments

Comments
 (0)