-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prioritize outputting relative paths #12974
base: main
Are you sure you want to change the base?
Conversation
Thanks @dongfangtianyu for the PR. I'm a bit worried about this change, as I expect this will break systems which expects those absolute paths to be there, such as IDEs which will often highlight those paths as links. @pytest-dev/core what are your opinions? |
i think we should consider this a breaking change as path construction changes perhaps a option to configure it might help and we switch it from absolute to cwd_relative with the next major release i really like the potentially better ux i do fear missed problems caused by output consuming software |
perhaps we want a concept of a "display path that collapss details it would render cwd relative paths to - but also perhaps this could also be expanded with $TMP_PATH and some more |
Hi @nicoddemus ,Your concern is valid. A brief test was conducted on PyCharm (2024.1.1) and VS Code (1.93.1): |
This is a classic pytest output, with most of its paths being relative paths:
This is the output for some scenarios (FixtureLookupError, skip, warnings): the absolute path (warnings summary) is output
This is the output of this PR: the relative paths of the files within the project are outputted, while the libraries and traceback maintain their original outputs
|
@dongfangtianyu did you post the correct outputs? I only see a single difference in the paths: 28c28
< self = <json.decoder.JSONDecoder object at 0x000002661F54C920>, s = 'xxxxx', idx = 0
---
> self = <json.decoder.JSONDecoder object at 0x000001CF1412C920>, s = 'xxxxx', idx = 0
48c48
< D:\git\github\dongfangtianyu\tmp_py312\a\b\c\test_demo.py:7: UserWarning: yyy
---
> a\b\c\test_demo.py:7: UserWarning: yyy
59c59,60
< =========================================== 1 failed, 3 warnings in 0.13s ============================================
---
> =========================================== 1 failed, 3 warnings in 0.12s ============================================
> |
@nicoddemus Yes. These contents are copied from the actual output. In this example, the PR converts
The traceback content is not processed for several reasons:
|
Oh no I agree we should not touch the traceback content, I was just making sure the post was correct. |
[ ] Include documentation when adding new features.closes #XYZW
to the PR description and/or commits.changelog
folderImplementation of #12973