blob: 10ee27ce08bb25f253e56809088878383bc5f457 [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
doko@ubuntu.com7a8634d2012-09-10 14:34:42 +020018basepath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
19 'Tools')
Éric Araujoe84e2632012-02-25 16:24:59 +010020
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()