• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Tests for scripts in the Tools/scripts directory.
2
3This file contains extremely basic regression tests for the scripts found in
4the Tools directory of a Python checkout or tarball which don't have separate
5tests of their own.
6"""
7
8import os
9import unittest
10from test.support import import_helper
11
12from test.test_tools import scriptsdir, import_tool, skip_if_missing
13
14skip_if_missing()
15
16class TestSundryScripts(unittest.TestCase):
17    # import logging registers "atfork" functions which keep indirectly the
18    # logging module dictionary alive. Mock the function to be able to unload
19    # cleanly the logging module.
20    @import_helper.mock_register_at_fork
21    def test_sundry(self, mock_os):
22        for fn in os.listdir(scriptsdir):
23            if not fn.endswith('.py'):
24                continue
25            name = fn[:-3]
26            import_tool(name)
27
28
29if __name__ == '__main__':
30    unittest.main()
31