mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Fix test_refactor
It was not run because test cases were collected from test/complete instead of test/refactor.
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
from os.path import join, dirname, abspath
|
||||
default_base_dir = join(dirname(abspath(__file__)), 'completion')
|
||||
import os
|
||||
|
||||
import base
|
||||
import run
|
||||
import refactor
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
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.")
|
||||
parser.addoption(
|
||||
"--refactor-case-dir",
|
||||
default=os.path.join(base.test_dir, 'refactor'),
|
||||
help="Directory in which refactoring test case files locate.")
|
||||
parser.addoption(
|
||||
"--test-files", "-T", default=[], action='append',
|
||||
help=(
|
||||
@@ -39,15 +44,16 @@ def pytest_generate_tests(metafunc):
|
||||
"""
|
||||
:type metafunc: _pytest.python.Metafunc
|
||||
"""
|
||||
base_dir = metafunc.config.option.base_dir
|
||||
test_files = dict(map(parse_test_files_option,
|
||||
metafunc.config.option.test_files))
|
||||
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))
|
||||
if 'refactor_case' in metafunc.fixturenames:
|
||||
base_dir = metafunc.config.option.refactor_case_dir
|
||||
metafunc.parametrize(
|
||||
'refactor_case',
|
||||
refactor.collect_dir_tests(base_dir, test_files))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
import base
|
||||
from run import \
|
||||
TEST_COMPLETIONS, TEST_DEFINITIONS, TEST_ASSIGNMENTS, TEST_USAGES
|
||||
|
||||
@@ -92,7 +93,7 @@ def run_related_name_test(case):
|
||||
|
||||
|
||||
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'))
|
||||
testers = {
|
||||
TEST_COMPLETIONS: run_completion_test,
|
||||
|
||||
Reference in New Issue
Block a user