fix(plugins): record plugin-compat hit paths in POSIX form on every OS
`scan_plugin` stored `str(p.relative_to(plugin_dir))`, which is `sub\m.py` on native Windows and `sub/m.py` elsewhere. The string is what compat notices print, what `plugins_cmd` renders as `file:line`, and what the tests pin, so the same plugin produced a different report per OS and `test_scan_plugin_walks_dir_and_skips_tests` failed on Windows (#112576). `.as_posix()` makes the recorded path stable and portable; nothing consumes the native form.
This commit is contained in:
@@ -189,7 +189,9 @@ def scan_plugin(plugin_dir: Optional[Path], manifest: Optional[Dict[str, Dict[st
|
||||
src = p.read_text(encoding="utf-8", errors="replace")
|
||||
except OSError:
|
||||
continue
|
||||
hits += scan_source(src, str(p.relative_to(plugin_dir)), manifest)
|
||||
# POSIX form on every OS: notices/reports compare and dedupe on this string, and the
|
||||
# compat tests pin ``sub/m.py`` — native Windows otherwise records ``sub\m.py`` (#112576).
|
||||
hits += scan_source(src, p.relative_to(plugin_dir).as_posix(), manifest)
|
||||
if cacheable:
|
||||
with _scan_lock:
|
||||
_scan_cache[key] = (signature, list(hits))
|
||||
|
||||
Reference in New Issue
Block a user