summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tools.py
blob: 10ee27ce08bb25f253e56809088878383bc5f457 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Tests for scripts in the Tools directory.

This file contains regression tests for some of the scripts found in the
Tools directory of a Python checkout or tarball, such as reindent.py.
"""

import os
import unittest
import sysconfig
from test import test_support
from test.script_helper import assert_python_ok

if not sysconfig.is_python_build():
    # XXX some installers do contain the tools, should we detect that
    # and run the tests in that case too?
    raise unittest.SkipTest('test irrelevant for an installed Python')

basepath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
                        'Tools')


class ReindentTests(unittest.TestCase):
    script = os.path.join(basepath, 'scripts', 'reindent.py')

    def test_noargs(self):
        assert_python_ok(self.script)

    def test_help(self):
        rc, out, err = assert_python_ok(self.script, '-h')
        self.assertEqual(out, b'')
        self.assertGreater(err, b'')


def test_main():
    test_support.run_unittest(ReindentTests)


if __name__ == '__main__':
    unittest.main()