diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml index 08bd5c8a87ee21..0afa0fe36b0ce4 100644 --- a/Lib/test/.ruff.toml +++ b/Lib/test/.ruff.toml @@ -3,13 +3,13 @@ select = [ "F811", # Redefinition of unused variable (useful for finding test methods with the same name) ] extend-exclude = [ + # Excluded (these aren't actually executed, they're just "data files") + "tokenizedata/*.py", # Failed to lint - "badsyntax_pep3120.py", "encoded_modules/module_iso_8859_1.py", "encoded_modules/module_koi8_r.py", "test_source_encoding.py", # Failed to parse - "badsyntax_3131.py", "test_fstring.py", # TODO Fix: F811 Redefinition of unused name "test_buffer.py", diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 4bb03908fc2bb2..4062afd7254870 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -78,7 +78,7 @@ def test_find_module_encoding(self): with imp.find_module('module_' + mod, self.test_path)[0] as fd: self.assertEqual(fd.encoding, encoding) - path = [os.path.dirname(__file__)] + path = [os.path.join(os.path.dirname(__file__), 'tokenizedata')] with self.assertRaises(SyntaxError): imp.find_module('badsyntax_pep3120', path) @@ -203,9 +203,11 @@ def test_issue5604(self): os_helper.rmtree('__pycache__') def test_issue9319(self): - path = os.path.dirname(__file__) + path = os.path.join(os.path.dirname(__file__), "tokenizedata") self.assertRaises(SyntaxError, - imp.find_module, "badsyntax_pep3120", [path]) + imp.find_module, + "badsyntax_pep3120", + [path]) def test_load_from_source(self): # Verify that the imp module can correctly load and find .py files diff --git a/Lib/test/test_utf8source.py b/Lib/test/test_utf8source.py index 97dced8a622889..c42b6aaaab579d 100644 --- a/Lib/test/test_utf8source.py +++ b/Lib/test/test_utf8source.py @@ -1,5 +1,3 @@ -# This file is marked as binary in the CVS, to prevent MacCVS from recoding it. - import unittest class PEP3120Test(unittest.TestCase): @@ -16,7 +14,7 @@ def test_pep3120(self): def test_badsyntax(self): try: - import test.badsyntax_pep3120 + import test.tokenizedata.badsyntax_pep3120 except SyntaxError as msg: msg = str(msg).lower() self.assertTrue('utf-8' in msg) diff --git a/Lib/test/badsyntax_pep3120.py b/Lib/test/tokenizedata/badsyntax_pep3120.py similarity index 100% rename from Lib/test/badsyntax_pep3120.py rename to Lib/test/tokenizedata/badsyntax_pep3120.py