mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Fix: --thirdparty was not considered
This commit is contained in:
@@ -25,7 +25,7 @@ def pytest_addoption(parser):
|
|||||||
"For example: -T generators.py:10,13,19. "
|
"For example: -T generators.py:10,13,19. "
|
||||||
"Note that you can use -m to specify the test case by id."))
|
"Note that you can use -m to specify the test case by id."))
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--thirdparty",
|
"--thirdparty", action='store_true',
|
||||||
help="Include integration tests that requires third party modules.")
|
help="Include integration tests that requires third party modules.")
|
||||||
|
|
||||||
|
|
||||||
@@ -53,9 +53,11 @@ def pytest_generate_tests(metafunc):
|
|||||||
if 'case' in metafunc.fixturenames:
|
if 'case' in metafunc.fixturenames:
|
||||||
base_dir = metafunc.config.option.integration_case_dir
|
base_dir = metafunc.config.option.integration_case_dir
|
||||||
thirdparty = metafunc.config.option.thirdparty
|
thirdparty = metafunc.config.option.thirdparty
|
||||||
metafunc.parametrize(
|
cases = list(run.collect_dir_tests(base_dir, test_files))
|
||||||
'case',
|
if thirdparty:
|
||||||
run.collect_dir_tests(base_dir, test_files, thirdparty))
|
cases.extend(run.collect_dir_tests(
|
||||||
|
os.path.join(base_dir, 'thirdparty'), test_files))
|
||||||
|
metafunc.parametrize('case', cases)
|
||||||
if 'refactor_case' in metafunc.fixturenames:
|
if 'refactor_case' in metafunc.fixturenames:
|
||||||
base_dir = metafunc.config.option.refactor_case_dir
|
base_dir = metafunc.config.option.refactor_case_dir
|
||||||
metafunc.parametrize(
|
metafunc.parametrize(
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ def collect_file_tests(lines, lines_to_execute):
|
|||||||
correct = None
|
correct = None
|
||||||
|
|
||||||
|
|
||||||
def collect_dir_tests(base_dir, test_files, thirdparty=False):
|
def collect_dir_tests(base_dir, test_files):
|
||||||
for f_name in os.listdir(base_dir):
|
for f_name in os.listdir(base_dir):
|
||||||
files_to_execute = [a for a in test_files.items() if a[0] in f_name]
|
files_to_execute = [a for a in test_files.items() if a[0] in f_name]
|
||||||
lines_to_execute = reduce(lambda x, y: x + y[1], files_to_execute, [])
|
lines_to_execute = reduce(lambda x, y: x + y[1], files_to_execute, [])
|
||||||
|
|||||||
Reference in New Issue
Block a user