Example #1
0
def load_tests(loader, tests, pattern):
    """
    Return a unittest.TestSuite instance of all Groome project tests.

    Arguments:

      tests: a unittest.TestSuite instance of the standard tests loaded
        from this module.

    """
    groome_dir = loader.test_config.groome_tests_dir

    template_tests = unittest.TestSuite()

    if groome_dir is None:
        # Then Groome tests are not expected to be available.
        pass
    elif not os.path.exists(groome_dir):
        _log.warn("Groome tests directory not found: %s\n"
                  "  Consult the documentation on how to include them." % groome_dir)
    else:
       type_args = make_template_tests_class(group_name='Groome',
                                             parent_input_dir=groome_dir)
       # We define the class in this module so that the test harness reports
       # the TestCase class as originating from this module.
       test_class = type(*type_args)
       template_tests = loader.loadTestsFromTestCase(test_class)

    _log.info("found %s Groome tests in dir: %s" % (template_tests.countTestCases(), groome_dir))

    tests.addTests(template_tests)

    tests = config_load_tests(loader, tests, pattern)

    return tests
Example #2
0
def load_tests(loader, tests, pattern):
    """
    Return a unittest.TestSuite instance testing the demo template.

    """
    type_args = make_test_class_type_args(group_name='Demo',
                                          template_dir=DEMO_TEMPLATE_DIR,
                                          should_stage=True)

    # We define the class in this module so that the test harness reports
    # the TestCase class as originating from this module.
    test_class = type(*type_args)

    demo_tests = loader.loadTestsFromTestCase(test_class)

    tests.addTests(demo_tests)

    tests = config_load_tests(loader, tests, pattern)

    return tests