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.
This commit is contained in:
Robert Collins 2014-11-05 03:43:36 +13:00
parent bf2bda3c97
commit 68b11d129d
1 changed files with 2 additions and 0 deletions

View File

@ -343,6 +343,8 @@ class TestLoader(object):
return os.path.dirname(full_path)
def _get_name_from_path(self, path):
if path == self._top_level_dir:
return '.'
path = _jython_aware_splitext(os.path.normpath(path))
_relpath = os.path.relpath(path, self._top_level_dir)