Esempio n. 1
0
def test():
    """Run tests against `tested_apps`"""
    from types import FunctionType
    if hasattr(fabfile, 'settings') and type(fabfile.settings) is not FunctionType:
        with html_coverage_report():
            run_django_tests(fabfile.settings, *fabfile.tested_apps)
        return
    else:
        test_module = "%s.tests" % get_full_name()
        try:
            __import__(test_module)
            tests = sys.modules[test_module]
        except ImportError:
            tests = False
            pass

        if tests:
            test_suite = getattr(tests, "suite", False)
            if test_suite:
                with html_coverage_report():
                    unittest.TextTestRunner().run(test_suite)
                return

    raise ImproperlyConfigured(
        "Unable to find tests to run.  Please see armstrong.dev README."
    )
Esempio n. 2
0
def test():
    """Run tests against `tested_apps`"""
    if hasattr(fabfile, 'settings' ):
        with html_coverage_report():
            run_django_tests(fabfile.settings, *fabfile.tested_apps)
    elif(hasattr(fabfile, 'test_suite')):
        test_suite=getattr(fabfile, 'test_suite')
        with html_coverage_report():
            unittest.TextTestRunner(verbosity=2).run(test_suite)
    else:
        error = '''The fabfile must either contain django settings or 
                    supply a test_suite. See the armstrong.apps.audio 
                    fabfile.py for a example of testing a django app. 
                    See armstrong.apps.audio.backends.id3reader fabfile.py 
                    for a example of running a simple test suite'''
        raise ImproperlyConfigured(error)