예제 #1
0
def main(verbosity=1, failfast=False, test_labels=None):
    verbosity = int(verbosity)
    if not test_labels:
        test_labels = ["filer"]
    with temp_dir() as STATIC_ROOT:
        with temp_dir() as MEDIA_ROOT:
            with temp_dir() as FILE_UPLOAD_TEMP_DIR:
                # from django import VERSION
                # use_tz = VERSION[:2] >= (1, 4)
                use_tz = False
                warnings.filterwarnings(
                    "error", r"DateTimeField received a naive datetime", RuntimeWarning, r"django\.db\.models\.fields"
                )
                configure(
                    ROOT_URLCONF="test_urls",
                    STATIC_ROOT=STATIC_ROOT,
                    MEDIA_ROOT=MEDIA_ROOT,
                    FILE_UPLOAD_TEMP_DIR=FILE_UPLOAD_TEMP_DIR,
                    USE_TZ=use_tz,
                )
                from django.conf import settings
                from django.test.utils import get_runner

                TestRunner = get_runner(settings)
                test_runner = TestRunner(verbosity=verbosity, interactive=False, failfast=failfast)
                failures = test_runner.run_tests(test_labels)
    sys.exit(failures)
예제 #2
0
def main(verbosity=1, failfast=False, test_labels=None):
    verbosity = int(verbosity)
    if not test_labels:
        test_labels = ['filer']
    with temp_dir() as STATIC_ROOT:
        with temp_dir() as MEDIA_ROOT:
            with temp_dir() as FILE_UPLOAD_TEMP_DIR:
                # from django import VERSION
                # use_tz = VERSION[:2] >= (1, 4)
                use_tz = False
                warnings.filterwarnings(
                    'error', r"DateTimeField received a naive datetime",
                    RuntimeWarning, r'django\.db\.models\.fields')
                configure(ROOT_URLCONF='test_urls',
                          STATIC_ROOT=STATIC_ROOT,
                          MEDIA_ROOT=MEDIA_ROOT,
                          FILE_UPLOAD_TEMP_DIR=FILE_UPLOAD_TEMP_DIR,
                          USE_TZ=use_tz)
                from django.conf import settings
                from django.test.utils import get_runner
                TestRunner = get_runner(settings)
                test_runner = TestRunner(verbosity=verbosity,
                                         interactive=False,
                                         failfast=failfast)
                failures = test_runner.run_tests(test_labels)
    sys.exit(failures)
예제 #3
0
def main(verbosity=1, failfast=False, test_labels=None, migrate=False):
    verbosity = int(verbosity)
    with temp_dir() as STATIC_ROOT:
        with temp_dir() as MEDIA_ROOT:
            with temp_dir() as FILE_UPLOAD_TEMP_DIR:
                from django import VERSION
                use_tz = VERSION[:2] >= (1, 4)
                test_suffix = ""
                if VERSION[:2] >= (1, 6):
                    test_suffix = ".tests"
                if not test_labels:
                    test_labels = ['filer%s' % test_suffix]
                else:
                    test_labels = ["filer%s.%s" % (test_suffix, label) for label in test_labels]
                warnings.filterwarnings(
                    'error', r"DateTimeField received a naive datetime",
                    RuntimeWarning, r'django\.db\.models\.fields')
                configure(
                    ROOT_URLCONF='test_urls',
                    STATIC_ROOT=STATIC_ROOT, MEDIA_ROOT=MEDIA_ROOT,
                    FILE_UPLOAD_TEMP_DIR=FILE_UPLOAD_TEMP_DIR,
                    SOUTH_TESTS_MIGRATE=migrate,
                    USE_TZ=use_tz)
                from django.conf import settings
                from django.test.utils import get_runner
                TestRunner = get_runner(settings)
                test_runner = TestRunner(verbosity=verbosity, interactive=False, failfast=failfast)
                failures = test_runner.run_tests(test_labels)
    sys.exit(failures)
예제 #4
0
def main(verbosity=1, failfast=False, test_labels=None, migrate=False,
         filer_image_model=False):
    verbosity = int(verbosity)
    with temp_dir() as STATIC_ROOT:
        with temp_dir() as MEDIA_ROOT:
            with temp_dir() as FILE_UPLOAD_TEMP_DIR:
                from django import VERSION
                use_tz = VERSION[:2] >= (1, 4)
                test_suffix = ""
                if VERSION[:2] >= (1, 6):
                    test_suffix = ".tests"
                if not test_labels:
                    test_labels = ['filer%s' % test_suffix]
                else:
                    test_labels = ["filer%s.%s" % (test_suffix, label) for label in test_labels]
                warnings.filterwarnings(
                    'error', r"DateTimeField received a naive datetime",
                    RuntimeWarning, r'django\.db\.models\.fields')
                configure(
                    ROOT_URLCONF='test_urls',
                    STATIC_ROOT=STATIC_ROOT, MEDIA_ROOT=MEDIA_ROOT,
                    FILE_UPLOAD_TEMP_DIR=FILE_UPLOAD_TEMP_DIR,
                    SOUTH_TESTS_MIGRATE=migrate,
                    FILER_IMAGE_MODEL=filer_image_model,
                    USE_TZ=use_tz)
                from django.conf import settings
                from django.test.utils import get_runner
                TestRunner = get_runner(settings)
                test_runner = TestRunner(verbosity=verbosity, interactive=False, failfast=failfast)
                failures = test_runner.run_tests(test_labels)
    sys.exit(failures)