Example #1
0
def run_tests(*args):
    from inline_media.tests import run_tests, delete_tmp_dirs
    errors = run_tests()
    delete_tmp_dirs()
    if errors:
        sys.exit(1)
    else:
        sys.exit(0)
Example #2
0
def run_tests():
    if not os.environ.get("DJANGO_SETTINGS_MODULE", False):
        setup_django_settings()

    import django
    from django.conf import settings
    from django.test.utils import get_runner
    from inline_media.tests import delete_tmp_dirs

    if django.VERSION[1] >= 7: # Django 1.7.x or above
        django.setup()
        runner = get_runner(settings,"django.test.runner.DiscoverRunner")
    else:
        runner = get_runner(settings,"django.test.simple.DjangoTestSuiteRunner")
    test_suite = runner(verbosity=2, interactive=True, failfast=False)
    results = test_suite.run_tests(["inline_media"])
    delete_tmp_dirs()
    return results
Example #3
0
 def run(self):
     import pytest
     from inline_media.tests import setup_django_settings, delete_tmp_dirs
     setup_django_settings()
     pytest.main(['-v',])
     delete_tmp_dirs()