1
0
forked from VimPlug/jedi

Fix test_refactor

It was not run because test cases were collected from test/complete
instead of test/refactor.
This commit is contained in:
Takafumi Arakaki
2013-03-12 07:00:44 +01:00
parent a31ba8737a
commit a993dd0da4
2 changed files with 12 additions and 5 deletions

View File

@@ -1,14 +1,19 @@
from os.path import join, dirname, abspath import os
default_base_dir = join(dirname(abspath(__file__)), 'completion')
import base
import run import run
import refactor import refactor
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption( parser.addoption(
"--base-dir", default=default_base_dir, "--integration-case-dir",
default=os.path.join(base.test_dir, 'completion'),
help="Directory in which integration test case files locate.") help="Directory in which integration test case files locate.")
parser.addoption(
"--refactor-case-dir",
default=os.path.join(base.test_dir, 'refactor'),
help="Directory in which refactoring test case files locate.")
parser.addoption( parser.addoption(
"--test-files", "-T", default=[], action='append', "--test-files", "-T", default=[], action='append',
help=( help=(
@@ -39,15 +44,16 @@ def pytest_generate_tests(metafunc):
""" """
:type metafunc: _pytest.python.Metafunc :type metafunc: _pytest.python.Metafunc
""" """
base_dir = metafunc.config.option.base_dir
test_files = dict(map(parse_test_files_option, test_files = dict(map(parse_test_files_option,
metafunc.config.option.test_files)) metafunc.config.option.test_files))
if 'case' in metafunc.fixturenames: if 'case' in metafunc.fixturenames:
base_dir = metafunc.config.option.integration_case_dir
thirdparty = metafunc.config.option.thirdparty thirdparty = metafunc.config.option.thirdparty
metafunc.parametrize( metafunc.parametrize(
'case', 'case',
run.collect_dir_tests(base_dir, test_files, thirdparty)) run.collect_dir_tests(base_dir, test_files, thirdparty))
if 'refactor_case' in metafunc.fixturenames: if 'refactor_case' in metafunc.fixturenames:
base_dir = metafunc.config.option.refactor_case_dir
metafunc.parametrize( metafunc.parametrize(
'refactor_case', 'refactor_case',
refactor.collect_dir_tests(base_dir, test_files)) refactor.collect_dir_tests(base_dir, test_files))

View File

@@ -1,6 +1,7 @@
import os import os
import re import re
import base
from run import \ from run import \
TEST_COMPLETIONS, TEST_DEFINITIONS, TEST_ASSIGNMENTS, TEST_USAGES TEST_COMPLETIONS, TEST_DEFINITIONS, TEST_ASSIGNMENTS, TEST_USAGES
@@ -92,7 +93,7 @@ def run_related_name_test(case):
def test_integration(case, monkeypatch, pytestconfig): def test_integration(case, monkeypatch, pytestconfig):
repo_root = os.path.dirname(os.path.dirname(pytestconfig.option.base_dir)) repo_root = base.root_dir
monkeypatch.chdir(os.path.join(repo_root, 'jedi')) monkeypatch.chdir(os.path.join(repo_root, 'jedi'))
testers = { testers = {
TEST_COMPLETIONS: run_completion_test, TEST_COMPLETIONS: run_completion_test,