Describe the bug
When outputting html coverage, a user will try to use browser builtin search to find a file, but the search will fail to find the desired file.
To Reproduce
Answer the questions below:
- What version of Python are you using? python3.13
- What version of coverage.py shows the problem? The output of
coverage debug sys is helpful.
- What commands should we run to reproduce the problem?
- run
coverage html
- then open
htmlcov/index.html
- in browser, type ctrl-f (or / depending on your browser)
- type a file path that is present in the page, e.g.
foo/bar/baz.py
- the file is not found, when looking in page, it seems there are spaces in name
- type instead
foo<space character>/<space character>bar<space character>/<space character>baz.py
- still not found
Expected behavior
The file should be found in browser search
Additional context
The problem is that coverage html outputs "fancy" unicode characters that nobody can type:
|
return re.sub(r"[/\\]", "\N{THIN SPACE}\\g<0>\N{THIN SPACE}", filename) |
it makes browser search unusable and it's tedious to find a file when there are hundreds of source files
best thing would be to plain remove the spaces but if you insist on keeping spaces, there are alternatives:
- use regular U+0020 spaces
- don't put spaces but use css to add spacing around slashes
Describe the bug
When outputting html coverage, a user will try to use browser builtin search to find a file, but the search will fail to find the desired file.
To Reproduce
Answer the questions below:
coverage debug sysis helpful.coverage htmlhtmlcov/index.htmlfoo/bar/baz.pyfoo<space character>/<space character>bar<space character>/<space character>baz.pyExpected behavior
The file should be found in browser search
Additional context
The problem is that coverage html outputs "fancy" unicode characters that nobody can type:
coveragepy/coverage/html.py
Line 860 in 8fba929
it makes browser search unusable and it's tedious to find a file when there are hundreds of source files
best thing would be to plain remove the spaces but if you insist on keeping spaces, there are alternatives: