aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_py_compile.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-09-12 09:37:42 +0300
committerGitHub <noreply@github.com>2023-09-12 09:37:42 +0300
commit1110c5bc828218086f6397ec05a9312fb73ea30a (patch)
treee552ff4258e48bb6131e3b2cc2f8b397ee3e4cc0 /Lib/test/test_py_compile.py
parent8c813faf864ac1d788a3efc45b4e76c1c3c3b340 (diff)
downloadcpython-1110c5bc828218086f6397ec05a9312fb73ea30a.tar.gz
cpython-1110c5bc828218086f6397ec05a9312fb73ea30a.zip
gh-108303: Move tokenize-related data to Lib/test/tokenizedata (GH-109265)
Diffstat (limited to 'Lib/test/test_py_compile.py')
-rw-r--r--Lib/test/test_py_compile.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index 5e0a44ad969..c4e6551f605 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -132,7 +132,9 @@ class PyCompileTestsBase:
os.chmod(self.directory, mode.st_mode)
def test_bad_coding(self):
- bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
+ bad_coding = os.path.join(os.path.dirname(__file__),
+ 'tokenizedata',
+ 'bad_coding2.py')
with support.captured_stderr():
self.assertIsNone(py_compile.compile(bad_coding, doraise=False))
self.assertFalse(os.path.exists(
@@ -195,7 +197,9 @@ class PyCompileTestsBase:
self.assertEqual(flags, 0b1)
def test_quiet(self):
- bad_coding = os.path.join(os.path.dirname(__file__), 'bad_coding2.py')
+ bad_coding = os.path.join(os.path.dirname(__file__),
+ 'tokenizedata',
+ 'bad_coding2.py')
with support.captured_stderr() as stderr:
self.assertIsNone(py_compile.compile(bad_coding, doraise=False, quiet=2))
self.assertIsNone(py_compile.compile(bad_coding, doraise=True, quiet=2))
@@ -260,14 +264,18 @@ class PyCompileCLITestCase(unittest.TestCase):
self.assertTrue(os.path.exists(self.cache_path))
def test_bad_syntax(self):
- bad_syntax = os.path.join(os.path.dirname(__file__), 'badsyntax_3131.py')
+ bad_syntax = os.path.join(os.path.dirname(__file__),
+ 'tokenizedata',
+ 'badsyntax_3131.py')
rc, stdout, stderr = self.pycompilecmd_failure(bad_syntax)
self.assertEqual(rc, 1)
self.assertEqual(stdout, b'')
self.assertIn(b'SyntaxError', stderr)
def test_bad_syntax_with_quiet(self):
- bad_syntax = os.path.join(os.path.dirname(__file__), 'badsyntax_3131.py')
+ bad_syntax = os.path.join(os.path.dirname(__file__),
+ 'tokenizedata',
+ 'badsyntax_3131.py')
rc, stdout, stderr = self.pycompilecmd_failure('-q', bad_syntax)
self.assertEqual(rc, 1)
self.assertEqual(stdout, b'')