| LEFT | RIGHT |
| (no file at all) | |
| 1 """Tests for scripts in the Tools directory. | 1 """Tests for scripts in the Tools directory. |
| 2 | 2 |
| 3 This file contains regression tests for some of the scripts found in the | 3 This file contains regression tests for some of the scripts found in the |
| 4 Tools directory of a Python checkout or tarball, such as reindent.py. | 4 Tools directory of a Python checkout or tarball, such as reindent.py. |
| 5 """ | 5 """ |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import importlib.machinery | 9 import importlib.machinery |
| 10 import unittest | 10 import unittest |
| 11 from unittest import mock | 11 from unittest import mock |
| 12 import sysconfig | 12 import sysconfig |
| 13 import tempfile | 13 import tempfile |
| 14 from test import support | 14 from test import support |
| 15 from test.script_helper import assert_python_ok | 15 from test.script_helper import assert_python_ok |
| 16 | 16 |
| 17 if not sysconfig.is_python_build(): | 17 if not sysconfig.is_python_build(): |
| 18 # XXX some installers do contain the tools, should we detect that | 18 # XXX some installers do contain the tools, should we detect that |
| 19 # and run the tests in that case too? | 19 # and run the tests in that case too? |
| 20 raise unittest.SkipTest('test irrelevant for an installed Python') | 20 raise unittest.SkipTest('test irrelevant for an installed Python') |
| 21 | 21 |
| 22 srcdir = sysconfig.get_config_var('projectbase') | 22 srcdir = sysconfig.get_config_var('srcdir') |
| 23 basepath = os.path.join(os.getcwd(), srcdir, 'Tools') | 23 basepath = os.path.join(os.getcwd(), srcdir, 'Tools') |
| 24 scriptsdir = os.path.join(basepath, 'scripts') | 24 scriptsdir = os.path.join(basepath, 'scripts') |
| 25 | 25 |
| 26 | 26 |
| 27 class ReindentTests(unittest.TestCase): | 27 class ReindentTests(unittest.TestCase): |
| 28 script = os.path.join(scriptsdir, 'reindent.py') | 28 script = os.path.join(scriptsdir, 'reindent.py') |
| 29 | 29 |
| 30 def test_noargs(self): | 30 def test_noargs(self): |
| 31 assert_python_ok(self.script) | 31 assert_python_ok(self.script) |
| 32 | 32 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 from test_unparse import UnparseTestCase | 129 from test_unparse import UnparseTestCase |
| 130 | 130 |
| 131 | 131 |
| 132 def test_main(): | 132 def test_main(): |
| 133 support.run_unittest(*[obj for obj in globals().values() | 133 support.run_unittest(*[obj for obj in globals().values() |
| 134 if isinstance(obj, type)]) | 134 if isinstance(obj, type)]) |
| 135 | 135 |
| 136 | 136 |
| 137 if __name__ == '__main__': | 137 if __name__ == '__main__': |
| 138 unittest.main() | 138 unittest.main() |
| LEFT | RIGHT |