mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
make the parametrizing of tests nicer for integration tests
This commit is contained in:
@@ -57,7 +57,8 @@ def pytest_generate_tests(metafunc):
|
|||||||
if thirdparty:
|
if thirdparty:
|
||||||
cases.extend(run.collect_dir_tests(
|
cases.extend(run.collect_dir_tests(
|
||||||
os.path.join(base_dir, 'thirdparty'), test_files, True))
|
os.path.join(base_dir, 'thirdparty'), test_files, True))
|
||||||
metafunc.parametrize('case', cases)
|
ids = ["%s:%s" % (c.module_name, c.line_nr_test) for c in cases]
|
||||||
|
metafunc.parametrize('case', cases, ids=ids)
|
||||||
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(
|
||||||
|
|||||||
12
test/run.py
12
test/run.py
@@ -139,12 +139,16 @@ class IntegrationTestCase(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def module_name(self):
|
def module_name(self):
|
||||||
return re.sub('.*/|\.py', '', self.path)
|
return re.sub('.*/|\.py$', '', self.path)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def line_nr_test(self):
|
||||||
|
"""The test is always defined on the line before."""
|
||||||
|
return self.line_nr - 1
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
name = os.path.basename(self.path) if self.path else None
|
return '<%s: %s:%s:%s>' % (self.__class__.__name__, self.module_name,
|
||||||
return '<%s: %s:%s:%s>' % (self.__class__.__name__,
|
self.line_nr_test, self.line.rstrip())
|
||||||
name, self.line_nr - 1, self.line.rstrip())
|
|
||||||
|
|
||||||
def script(self):
|
def script(self):
|
||||||
return jedi.Script(self.source, self.line_nr, self.column, self.path)
|
return jedi.Script(self.source, self.line_nr, self.column, self.path)
|
||||||
|
|||||||
Reference in New Issue
Block a user