mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
test_runner: Support only Django version >= 1.11.
In previous versions, the argument to run_subsuite is a tuple of length 3, while in versions >= 1.11 it's a tuple of length 4.
This commit is contained in:
@@ -240,31 +240,15 @@ def process_instrumented_calls(func):
|
|||||||
func(call)
|
func(call)
|
||||||
|
|
||||||
SerializedSubsuite = Tuple[Type[Iterable[TestCase]], List[str]]
|
SerializedSubsuite = Tuple[Type[Iterable[TestCase]], List[str]]
|
||||||
SubsuiteArgs = Union[
|
SubsuiteArgs = Tuple[Type['RemoteTestRunner'], int, SerializedSubsuite, bool]
|
||||||
Tuple[Type['RemoteTestRunner'], int, SerializedSubsuite, bool],
|
|
||||||
Tuple[int, SerializedSubsuite, bool]
|
|
||||||
]
|
|
||||||
|
|
||||||
def run_subsuite(args):
|
def run_subsuite(args):
|
||||||
# type: (SubsuiteArgs) -> Tuple[int, Any]
|
# type: (SubsuiteArgs) -> Tuple[int, Any]
|
||||||
# Reset the accumulated INSTRUMENTED_CALLS before running this subsuite.
|
# Reset the accumulated INSTRUMENTED_CALLS before running this subsuite.
|
||||||
test_helpers.INSTRUMENTED_CALLS = []
|
test_helpers.INSTRUMENTED_CALLS = []
|
||||||
if len(args) == 4:
|
# The first argument is the test runner class but we don't need it
|
||||||
# This condition runs for Django 1.11. The first argument is the
|
# because we run our own version of the runner class.
|
||||||
# test runner class but we don't need it because we run our own
|
|
||||||
# version of the runner class.
|
|
||||||
args = cast(Tuple[Type[RemoteTestRunner],
|
|
||||||
int,
|
|
||||||
SerializedSubsuite,
|
|
||||||
bool], args)
|
|
||||||
_, subsuite_index, subsuite, failfast = args
|
_, subsuite_index, subsuite, failfast = args
|
||||||
else:
|
|
||||||
# We are making mypy to ignore the following line because
|
|
||||||
# it is only valid in Django 1.10. In Django 1.11, this
|
|
||||||
# tuple is made up of 4 elements.
|
|
||||||
args = cast(Tuple[int, SerializedSubsuite, bool], args)
|
|
||||||
subsuite_index, subsuite, failfast = args
|
|
||||||
|
|
||||||
runner = RemoteTestRunner(failfast=failfast)
|
runner = RemoteTestRunner(failfast=failfast)
|
||||||
result = runner.run(deserialize_suite(subsuite))
|
result = runner.run(deserialize_suite(subsuite))
|
||||||
# Now we send instrumentation related events. This data will be
|
# Now we send instrumentation related events. This data will be
|
||||||
|
|||||||
Reference in New Issue
Block a user