Skip to content

Commit c6b1a07

Browse files
gh-131853: Fix test_msgfmt on big-endian platforms (GH-131879)
Use a generated .mo file instead of a checked in one.
1 parent fccf9ab commit c6b1a07

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/test/test_tools/test_msgfmt.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ def test_compilation(self):
4242
self.assertDictEqual(actual._catalog, expected._catalog)
4343

4444
def test_binary_header(self):
45-
with open(data_dir / "general.mo", "rb") as f:
46-
mo_data = f.read()
45+
with temp_cwd():
46+
tmp_mo_file = 'messages.mo'
47+
compile_messages(data_dir / "general.po", tmp_mo_file)
48+
with open(tmp_mo_file, 'rb') as f:
49+
mo_data = f.read()
4750

4851
(
4952
magic,
@@ -53,7 +56,7 @@ def test_binary_header(self):
5356
trans_table_offset,
5457
hash_table_size,
5558
hash_table_offset,
56-
) = struct.unpack("=Iiiiiii", mo_data[:28])
59+
) = struct.unpack("=7I", mo_data[:28])
5760

5861
self.assertEqual(magic, 0x950412de)
5962
self.assertEqual(version, 0)

0 commit comments

Comments
 (0)