diff --git a/test/conftest.py b/test/conftest.py index df0ecd1d..a2933f4b 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -57,7 +57,8 @@ def pytest_generate_tests(metafunc): if thirdparty: cases.extend(run.collect_dir_tests( 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: base_dir = metafunc.config.option.refactor_case_dir metafunc.parametrize( diff --git a/test/run.py b/test/run.py index ab265af0..c6fd7640 100755 --- a/test/run.py +++ b/test/run.py @@ -139,12 +139,16 @@ class IntegrationTestCase(object): @property 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): - name = os.path.basename(self.path) if self.path else None - return '<%s: %s:%s:%s>' % (self.__class__.__name__, - name, self.line_nr - 1, self.line.rstrip()) + return '<%s: %s:%s:%s>' % (self.__class__.__name__, self.module_name, + self.line_nr_test, self.line.rstrip()) def script(self): return jedi.Script(self.source, self.line_nr, self.column, self.path)