2015-02-10 05:41:57 +08:00
|
|
|
from django.test.runner import DiscoverRunner
|
|
|
|
|
|
|
|
|
|
|
|
class CustomOptionsTestRunner(DiscoverRunner):
|
2015-09-12 07:33:12 +08:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
verbosity=1,
|
|
|
|
interactive=True,
|
|
|
|
failfast=True,
|
2016-04-08 10:04:45 +08:00
|
|
|
option_a=None,
|
|
|
|
option_b=None,
|
|
|
|
option_c=None,
|
|
|
|
**kwargs,
|
|
|
|
):
|
2017-01-21 21:13:44 +08:00
|
|
|
super().__init__(
|
|
|
|
verbosity=verbosity, interactive=interactive, failfast=failfast
|
|
|
|
)
|
2015-02-10 05:41:57 +08:00
|
|
|
self.option_a = option_a
|
|
|
|
self.option_b = option_b
|
|
|
|
self.option_c = option_c
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def add_arguments(cls, parser):
|
2023-08-22 18:42:57 +08:00
|
|
|
parser.add_argument("--option_a", "-a", default="1")
|
|
|
|
parser.add_argument("--option_b", "-b", default="2")
|
|
|
|
parser.add_argument("--option_c", "-c", default="3")
|
2015-02-10 05:41:57 +08:00
|
|
|
|
2021-07-16 05:56:41 +08:00
|
|
|
def run_tests(self, test_labels, **kwargs):
|
2015-02-10 05:41:57 +08:00
|
|
|
print("%s:%s:%s" % (self.option_a, self.option_b, self.option_c))
|