Skip to content
test.py 843 B
Newer Older
from __future__ import annotations

Dong Zhuang's avatar
Dong Zhuang committed
from django.core.management.commands.test import Command as DjangoTestCommand


class Command(DjangoTestCommand):
    def add_arguments(self, parser):
Dong Zhuang's avatar
Dong Zhuang committed
        parser.add_argument(
            "--local_test_settings", action="store",
            dest="local_test_settings",
            help=("Overrides the default local test setting file path. "
                  "The default value is 'local_settings_example.py' in "
                  "project root. Note that local settings for production "
Dong Zhuang's avatar
Dong Zhuang committed
                  '("local_settings.py") is not allowed to be used '
                  "for unit tests for security reason.")
Dong Zhuang's avatar
Dong Zhuang committed
        )

    def handle(self, *test_labels, **options):
        del options["local_test_settings"]
        super().handle(*test_labels, **options)