Kaydet (Commit) 68b11d12 authored tarafından Robert Collins's avatar Robert Collins

Fix regression in issue 22457 fix.

When used in the real world it can under some situations trigger
"    assert not _relpath.startswith('..'), "Path must be within the project"
     AssertionError: Path must be within the project
"

Because _get_name_from_path was not expecting to be called with the top level
directory.
üst bf2bda3c
...@@ -343,6 +343,8 @@ class TestLoader(object): ...@@ -343,6 +343,8 @@ class TestLoader(object):
return os.path.dirname(full_path) return os.path.dirname(full_path)
def _get_name_from_path(self, path): def _get_name_from_path(self, path):
if path == self._top_level_dir:
return '.'
path = _jython_aware_splitext(os.path.normpath(path)) path = _jython_aware_splitext(os.path.normpath(path))
_relpath = os.path.relpath(path, self._top_level_dir) _relpath = os.path.relpath(path, self._top_level_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment