mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Disallowed importing concrete models without an application.
Removed fragile algorithm to find which application a model belongs to. Fixed #21680, #21719. Refs #21794.
This commit is contained in:
parent
c7a6996df7
commit
1b8af4cfa0
4 changed files with 32 additions and 58 deletions
20
tests/test_runner/runner.py
Normal file
20
tests/test_runner/runner.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from django.test.runner import DiscoverRunner
|
||||
|
||||
|
||||
class CustomOptionsTestRunner(DiscoverRunner):
|
||||
|
||||
def __init__(self, verbosity=1, interactive=True, failfast=True, option_a=None, option_b=None, option_c=None, **kwargs):
|
||||
super(CustomOptionsTestRunner, self).__init__(verbosity=verbosity, interactive=interactive,
|
||||
failfast=failfast)
|
||||
self.option_a = option_a
|
||||
self.option_b = option_b
|
||||
self.option_c = option_c
|
||||
|
||||
@classmethod
|
||||
def add_arguments(cls, parser):
|
||||
parser.add_argument('--option_a', '-a', action='store', dest='option_a', default='1'),
|
||||
parser.add_argument('--option_b', '-b', action='store', dest='option_b', default='2'),
|
||||
parser.add_argument('--option_c', '-c', action='store', dest='option_c', default='3'),
|
||||
|
||||
def run_tests(self, test_labels, extra_tests=None, **kwargs):
|
||||
print("%s:%s:%s" % (self.option_a, self.option_b, self.option_c))
|
Loading…
Add table
Add a link
Reference in a new issue