mirror of
https://github.com/python/cpython.git
synced 2025-09-14 12:46:49 +00:00

changeset: 77827:c23b442b5d5e user: Antoine Pitrou <solipsis@pitrou.net> date: Thu Jun 28 01:20:26 2012 +0200 summary: Avoid using scrdir, it's broken. changeset: 77826:f0e58e778215 user: Neil Schemenauer <nas@arctrix.com> date: Wed Jun 27 15:58:37 2012 -0600 summary: Fix bug in test_tools that prevented building is separate directory.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""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()
|