Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: e6c6f69ac935d045034712e53ee64fe46434e460 authored by Larry Hastings on 25 August 2015, 03:31:53 UTC
Version bump for Python 3.5.0rc2.
Tip revision: e6c6f69
__init__.py
"""Support functions for testing scripts in the Tools directory."""
import os
import unittest
import importlib
from test import support
from fnmatch import fnmatch

basepath = os.path.dirname(                 # <src/install dir>
                os.path.dirname(                # Lib
                    os.path.dirname(                # test
                        os.path.dirname(__file__))))    # test_tools

toolsdir = os.path.join(basepath, 'Tools')
scriptsdir = os.path.join(toolsdir, 'scripts')

def skip_if_missing():
    if not os.path.isdir(scriptsdir):
        raise unittest.SkipTest('scripts directory could not be found')

def import_tool(toolname):
    with support.DirsOnSysPath(scriptsdir):
        return importlib.import_module(toolname)

def load_tests(*args):
    return support.load_package_tests(os.path.dirname(__file__), *args)
back to top