gh-96272: Replace test_source_encoding's test_pep263 with test_import_encoded_module from test_imp (GH-96275)

Editors don't agree that `test_source_encoding.py` was valid koi8-r, making it
hard to edit that file without the editor breaking it in some way (see gh-96272).

Only one test actually relied on the koi8-r encoding and it was a duplicate of a
test from the deprecated `imp` module's `test_imp`, so here we replace
`test_pep263` with `test_import_encoded_module` stolen from `test_imp` and
set `test_source_encoding.py`'s encoding to utf-8 to make editing it easier
going forward.
This commit is contained in:
Michael Droettboom 2022-08-25 15:19:16 -04:00 committed by GitHub
parent caa2a9799a
commit ce1e73fbfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 15 deletions

View file

@ -66,11 +66,7 @@ class ImportTests(unittest.TestCase):
self.test_strings = mod.test_strings
self.test_path = mod.__path__
def test_import_encoded_module(self):
for modname, encoding, teststr in self.test_strings:
mod = importlib.import_module('test.encoded_modules.'
'module_' + modname)
self.assertEqual(teststr, mod.test)
# test_import_encoded_module moved to test_source_encoding.py
def test_find_module_encoding(self):
for mod, encoding, _ in self.test_strings: