def run_tests():
    suite = unittest.TestSuite()

    test_class = driver = None

    # Test each driver in gauged/drivers. We need to dynamically subclass
    # the TestDriver class here - the unittest module doesn't allow us to
    # use __init__ to pass in driver arguments or a driver instance
    for driver, dsn in test_drivers:
        try:
            gauged_instance = gauged.Gauged(dsn)
            # Empty the data store
            gauged_instance.driver.drop_schema()
            gauged_instance.sync()
            gauged_instance.driver.create_schema()
            # Test the driver class
            test_class = type('Test%s' % driver, (TestDriver,), {})
            test_class.driver = gauged_instance.driver
            suite.addTest(unittest.makeSuite(test_class))
            # Test gauged/gauged.py using the driver
            if not drivers_only:
                test_class = type('TestGaugedWith%s' % driver,
                                  (TestGauged,), {})
                test_class.driver = gauged_instance.driver
                suite.addTest(unittest.makeSuite(test_class))
        except Exception as e:  # pylint: disable=broad-except
            print 'Skipping %s tests (%s). Check test_driver.cfg' % \
                (driver[:-6], str(e).rstrip())
            if raise_on_error:
                raise

    if test_class is None:
        raise RuntimeWarning('No drivers available for unit tests, check '
                             'configuration in test_driver.cfg')

    # Test the remaining classes
    if not drivers_only:
        suite.addTest(unittest.makeSuite(TestStructures))
        suite.addTest(unittest.makeSuite(TestLRU))
        suite.addTest(unittest.makeSuite(TestDSN))
        suite.addTest(unittest.makeSuite(TestResult))

    # Setup the test runner
    verbosity = 2 if verbose else 1
    if run_forever:
        verbosity = 0
    test_runner = unittest.TextTestRunner(verbosity=verbosity)

    # Run the tests
    while True:
        result = test_runner.run(suite)
        if result.errors or result.failures:
            exit(1)
        if not run_forever:
            break
        gc.collect()
dataset/ETHPy150Open chriso/gauged/test.py/run_tests/original