FileLocator.relative_filename() could mangle the path too much in some unlikely cases · Issue #194 · nedbat/coveragepy (original) (raw)

Originally reported by Marius Gedminas (Bitbucket: mgedmin, GitHub: mgedmin)


If your working directory is /src/myproject and you happen to have your source files in /src/myproject/branchname/src/myproject/foo.py, FileLocator().relative_filename() will strip both '/src/myproject/' substrings from the path, leaving just 'branchnamefoo.py'.

I'm attaching a test case and a fix.