# Path: pygr/logger.py
# PYTHON_25 = sys.version_info >= (2, 5)
# def get_logger(name='pygr-log', stream=sys.stdout, formatter=None):
# def disable(level=0):
# def test(verbose=0):


import os
import re
import shutil
import sys
import unittest
from testlib import testutil, testoptions
from testlib.unittest_extensions import PygrTestRunner
from pygr import logger


def all_tests():
    "Returns all file names that end in _test.py"
    patt = re.compile("_test.py$")
    mods = os.listdir(os.path.normpath(os.path.dirname(__file__)))
    mods = filter(patt.search, mods)

    # some predictable order...
    mods.sort()
    return mods


def run(targets, options):
    "Imports and runs the modules names that are contained in the 'targets'"

    success = errors = skipped = 0

    # run the tests by importing the module and getting its test suite
    for name in targets:
        try:
            testutil.info('running tests for module %s' % name)
            l = unittest.TestLoader()
            suite = l.loadTestsFromName(name)

            runner = PygrTestRunner(verbosity=options.verbosity,
                                    descriptions=0)

            logger.disable(disable_threshold)  # set global override
            results = runner.run(suite)

# Path: pygr/logger.py
# PYTHON_25 = sys.version_info >= (2, 5)
# def get_logger(name='pygr-log', stream=sys.stdout, formatter=None):
# def disable(level=0):
# def test(verbose=0):


# Path: tests/runtest.py
import os
import re
import shutil
import sys
import unittest
from testlib import testutil, testoptions
from testlib.unittest_extensions import PygrTestRunner
from pygr import logger



def all_tests():
    "Returns all file names that end in _test.py"
    patt = re.compile("_test.py$")
    mods = os.listdir(os.path.normpath(os.path.dirname(__file__)))
    mods = filter(patt.search, mods)

    # some predictable order...
    mods.sort()
    return mods


def run(targets, options):
    "Imports and runs the modules names that are contained in the 'targets'"

    success = errors = skipped = 0

    # run the tests by importing the module and getting its test suite
    for name in targets:
        try:
            testutil.info('running tests for module %s' % name)
            l = unittest.TestLoader()
            suite = l.loadTestsFromName(name)

            runner = PygrTestRunner(verbosity=options.verbosity,
                                    descriptions=0)

            logger.disable(disable_threshold)  # set global override
            results = runner.run(suite)

            logger.disable(0)                  # clear global override