Skip to content

Conversation

@ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Jun 5, 2019

By default terminals would open files in editors and URLs in browsers.

By printing the generated html report using an URL (file://) we enable
users to click the terminal to open it. Previously this opened the file
in the text editor which is very unlikely to be what user would want.

By default terminals would open files in editors and URLs in browsers.

By printing the generated html report using an URL (file://) we enable
users to click the terminal to open it. Previously this opened the file
in the text editor which is very unlikely to be what user would want.
Copy link
Member

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file://foo is not a correct file URL, see https://en.wikipedia.org/wiki/File_URI_scheme - also, you'd probably want to print the absolute filename there, I don't think relative file URLs are a thing.

At that point, I'd probably print both though, to make it easier to copy-paste the filename...

@BeyondEvil
Copy link
Contributor

file://foo is not a correct file URL, see https://en.wikipedia.org/wiki/File_URI_scheme - also, you'd probably want to print the absolute filename there, I don't think relative file URLs are a thing.

At that point, I'd probably print both though, to make it easier to copy-paste the filename...

Actually, file:// should work, since pytest-html already prints the absolute path: /Users/jimbrannlund/dev/proxy/api/test/e2e/report.html

@ssbarnea
Copy link
Member Author

ssbarnea commented Jun 5, 2019

Yep, the path is not relative by default which means that adding file:// prefix makes it valid. I tested and worked fine for me (final url has 3 slashes).

Copy link
Contributor

@BeyondEvil BeyondEvil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Maybe @RibeiroAna want's to have a say as well?

@The-Compiler
Copy link
Member

Ah, sorry, my bad! Didn't see that the path was absolute.

@ssbarnea
Copy link
Member Author

Any chance to see this merged and ideally included in a release? I kinda miss it.

@RibeiroAna RibeiroAna merged commit 6ff7b96 into pytest-dev:master Jun 17, 2019
@ssbarnea
Copy link
Member Author

@RibeiroAna Thanks!

@ssbarnea ssbarnea deleted the clickable-file branch June 17, 2019 16:48
ssbarnea added a commit to ssbarnea/pytest-html that referenced this pull request Sep 12, 2019
By default terminals would open files in editors and URLs in browsers.

By printing the generated html report using an URL (file://) we enable
users to click the terminal to open it. Previously this opened the file
in the text editor which is very unlikely to be what user would want.
@ssbarnea ssbarnea added the feature This issue/PR relates to a feature request. label Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature This issue/PR relates to a feature request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants