Skip to content

Commit 46c025d

Browse files
committed
gh-62824: Adjust test_alias_modules_exist test to allow .pyc codec files
In Fedora, we install many codecs as .pyc files to save space. This test was failing when running from installed Python: ====================================================================== FAIL: test_alias_modules_exist (test.test_codecs.TransformCodecTest.test_alias_modules_exist) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib64/python3.14/test/test_codecs.py", line 3115, in test_alias_modules_exist self.assertTrue(os.path.isfile(codec_file), ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "Codec file not found: " + codec_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: False is not true : Codec file not found: /usr/lib64/python3.14/encodings/cp037.py ----------------------------------------------------------------------
1 parent 9bf03c6 commit 46c025d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_codecs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,9 @@ def test_alias_modules_exist(self):
31123112
encodings_dir = os.path.dirname(encodings.__file__)
31133113
for value in encodings.aliases.aliases.values():
31143114
codec_file = os.path.join(encodings_dir, value + ".py")
3115-
self.assertTrue(os.path.isfile(codec_file),
3115+
pyc_file = codec_file + "c"
3116+
self.assertTrue(os.path.isfile(codec_file)
3117+
or os.path.isfile(pyc_file),
31163118
"Codec file not found: " + codec_file)
31173119

31183120
def test_quopri_stateless(self):

0 commit comments

Comments
 (0)