Issue 7076 - relative path to invocation dir (not rootdir) - #7158
Merged
Conversation
nicoddemus
approved these changes
May 4, 2020
nicoddemus
left a comment
Member
There was a problem hiding this comment.
Thanks @CarycaKatarzyna!
This approach looks good to me, thanks.
I was about to comment to use reportinfo() instead of location in skipping.py, but I had already tested it locally so decided to just push the change myself. 👍
| @@ -169,6 +169,7 @@ def pytest_runtest_makereport(item, call): | |||
| # the location of where the skip exception was raised within pytest | |||
| _, _, reason = rep.longrepr | |||
| filename, line = item.location[:2] | |||
Member
There was a problem hiding this comment.
A bit weird that location explicitly returns a relative path to rootdir:
Lines 586 to 595 in 80e5098
To me it would make more sense to always return the full path, and the user can decide to make that path relative to whatever he wants.
This is not really related to the PR, just some musings after looking at the code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My second approach to issue #7076 (previous pull request - #7095 ). I've changed the path to absolute by joining with the
rootdir. Next it is changed into relative to theinvocation_dirin this place:pytest/src/_pytest/terminal.py
Line 1162 in 80e5098
I'm also adding a test that runs with
rootdirnot equal toinvocation_dir.Fixes #7076.