https://github.com/python/cpython/commit/266b541cc6f231d9e04fa2084d5c67acd9c7b572 commit: 266b541cc6f231d9e04fa2084d5c67acd9c7b572 branch: 3.14 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: encukou <encu...@gmail.com> date: 2025-05-27T11:28:30+02:00 summary:
[3.14] gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777) (GH-134781) gh-62824: Adjust test_alias_modules_exist test to use imports instead of file checks (GH-134777) (cherry picked from commit 8704d6b39139d2b1c3dd871590188fb7deb8aaad) Co-authored-by: Miro HronĨok <m...@hroncok.cz> files: M Lib/test/test_codecs.py diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 8c9a0972492294..d8666f7290e72e 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -1,6 +1,7 @@ import codecs import contextlib import copy +import importlib import io import pickle import os @@ -3111,9 +3112,9 @@ def test_aliases(self): def test_alias_modules_exist(self): encodings_dir = os.path.dirname(encodings.__file__) for value in encodings.aliases.aliases.values(): - codec_file = os.path.join(encodings_dir, value + ".py") - self.assertTrue(os.path.isfile(codec_file), - "Codec file not found: " + codec_file) + codec_mod = f"encodings.{value}" + self.assertIsNotNone(importlib.util.find_spec(codec_mod), + f"Codec module not found: {codec_mod}") def test_quopri_stateless(self): # Should encode with quotetabs=True _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: arch...@mail-archive.com