[3.12] gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265) (#109677)

* gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)

(cherry picked from commit 1110c5bc82)

* gh-108303: Add `Lib/test/tokenizedata` to `TESTSUBDIRS` (#109314)

(cherry picked from commit 42ab2cbd7b)

---------

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Victor Stinner 2023-10-02 17:11:24 +02:00 committed by GitHub
parent 9bceb8a79b
commit ed4ffd7404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 41 additions and 25 deletions

View file

@ -68,6 +68,7 @@ class MiscSourceEncodingTest(unittest.TestCase):
def test_20731(self):
sub = subprocess.Popen([sys.executable,
os.path.join(os.path.dirname(__file__),
'tokenizedata',
'coding20731.py')],
stderr=subprocess.PIPE)
err = sub.communicate()[1]
@ -100,10 +101,10 @@ class MiscSourceEncodingTest(unittest.TestCase):
self.verify_bad_module(module_name)
def verify_bad_module(self, module_name):
self.assertRaises(SyntaxError, __import__, 'test.' + module_name)
self.assertRaises(SyntaxError, __import__, 'test.tokenizedata.' + module_name)
path = os.path.dirname(__file__)
filename = os.path.join(path, module_name + '.py')
filename = os.path.join(path, 'tokenizedata', module_name + '.py')
with open(filename, "rb") as fp:
bytes = fp.read()
self.assertRaises(SyntaxError, compile, bytes, filename, 'exec')