mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
test_runner: Fix type annotation of get_tests_from_suite.
It is really a generator of test cases from the test suite. Which should be typed as an `Iterable` instead. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
committed by
Tim Abbott
parent
3ad9876d69
commit
c2342a5ece
@@ -2,8 +2,9 @@ import multiprocessing
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
import unittest
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union, cast
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Type, Union, cast
|
||||||
from unittest import TestLoader, TestSuite, mock, runner
|
from unittest import TestLoader, TestSuite, mock, runner
|
||||||
from unittest.result import TestResult
|
from unittest.result import TestResult
|
||||||
|
|
||||||
@@ -451,7 +452,7 @@ def get_test_names(suite: Union[TestSuite, ParallelTestSuite]) -> List[str]:
|
|||||||
return [t.id() for t in get_tests_from_suite(suite)]
|
return [t.id() for t in get_tests_from_suite(suite)]
|
||||||
|
|
||||||
|
|
||||||
def get_tests_from_suite(suite: TestSuite) -> TestCase:
|
def get_tests_from_suite(suite: TestSuite) -> Iterable[unittest.TestCase]:
|
||||||
for test in suite:
|
for test in suite:
|
||||||
if isinstance(test, TestSuite):
|
if isinstance(test, TestSuite):
|
||||||
yield from get_tests_from_suite(test)
|
yield from get_tests_from_suite(test)
|
||||||
|
|||||||
Reference in New Issue
Block a user