Skip to content

Generate implicit aliases for nested relative paths - #2233

Open
JSap0914 wants to merge 1 commit into
coveragepy:mainfrom
JSap0914:fix/path-alias-relative-suffix-2195
Open

JSap0914 wants to merge 1 commit into
coveragepy:mainfrom
JSap0914:fix/path-alias-relative-suffix-2195

Conversation

@JSap0914

Copy link
Copy Markdown
Contributor

What changed

  • Generate implicit relative-path aliases for every directory component instead of only the first component.
  • Add a regression test for a combined path whose usable local source is a deeper existing suffix.

Why

With relative_files = true, the first relative filename seen during combine could generate an alias such as */work -> work/. If that target did not exist locally, the path stayed unchanged even when a deeper suffix such as src/pkg/module.py did exist. Because input file ordering can vary, this produced intermittent No source for code errors.

Fixes #2195

Tests

  • python -m pytest tests/test_files.py::PathAliasesTest::test_implicit_relative_path_uses_existing_suffix -q
  • python -m pytest tests/test_files.py -q
  • tox -q -e py313 (C tracer: 1592 passed; Python tracer: 1561 passed; sys.monitoring: 1542 passed)
  • tox -q -e lint
  • tox -q -e mypy
  • pre-commit run --files coverage/files.py tests/test_files.py

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Random/flaky "No source for code" errors

1 participant