1
0
forked from VimPlug/jedi

Fix: --thirdparty was not considered

This commit is contained in:
Takafumi Arakaki
2013-03-12 11:24:48 +01:00
parent c87d3dad52
commit de7092d56b
2 changed files with 7 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ def pytest_addoption(parser):
"For example: -T generators.py:10,13,19. "
"Note that you can use -m to specify the test case by id."))
parser.addoption(
"--thirdparty",
"--thirdparty", action='store_true',
help="Include integration tests that requires third party modules.")
@@ -53,9 +53,11 @@ def pytest_generate_tests(metafunc):
if 'case' in metafunc.fixturenames:
base_dir = metafunc.config.option.integration_case_dir
thirdparty = metafunc.config.option.thirdparty
metafunc.parametrize(
'case',
run.collect_dir_tests(base_dir, test_files, thirdparty))
cases = list(run.collect_dir_tests(base_dir, test_files))
if 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:
base_dir = metafunc.config.option.refactor_case_dir
metafunc.parametrize(

View File

@@ -171,7 +171,7 @@ def collect_file_tests(lines, lines_to_execute):
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):
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, [])