blob: 0cad0c4c91ba5a12bdd891afbfbe8661adcdb644 [file] [log] [blame]
Éric Araujoe84e2632012-02-25 16:24:59 +01001"""Tests for scripts in the Tools directory.
2
3This file contains regression tests for some of the scripts found in the
4Tools directory of a Python checkout or tarball, such as reindent.py.
5"""
6
7import os
8import unittest
9import sysconfig
10from test import test_support
11from test.script_helper import assert_python_ok
12
13if not sysconfig.is_python_build():
14 # XXX some installers do contain the tools, should we detect that
15 # and run the tests in that case too?
16 raise unittest.SkipTest('test irrelevant for an installed Python')
17
18srcdir = sysconfig.get_config_var('projectbase')
19basepath = os.path.join(os.getcwd(), srcdir, 'Tools')
20
21
22class ReindentTests(unittest.TestCase):
23 script = os.path.join(basepath, 'scripts', 'reindent.py')
24
25 def test_noargs(self):
26 assert_python_ok(self.script)
27
28 def test_help(self):
29 rc, out, err = assert_python_ok(self.script, '-h')
30 self.assertEqual(out, b'')
31 self.assertGreater(err, b'')
32
33
34def test_main():
35 test_support.run_unittest(ReindentTests)
36
37
38if __name__ == '__main__':
39 unittest.main()