Skip to content

Issue 7126 - "saferepr" to avoid BytesWarning when using --setup-show#7205

Merged
bluetech merged 8 commits into
pytest-dev:masterfrom
lancelote:7126
May 14, 2020
Merged

Issue 7126 - "saferepr" to avoid BytesWarning when using --setup-show#7205
bluetech merged 8 commits into
pytest-dev:masterfrom
lancelote:7126

Conversation

@lancelote

@lancelote lancelote commented May 9, 2020

Copy link
Copy Markdown
Contributor

Fix for #7126

I added a special case for bytes only as saferepr adds quotes to pure string literals. A bunch of tests depend on the original behavior, so I was not comfortable changing it globally. Scrapping saferepr output to match the original behavior doesn't sound as a trouble-proof solution too. Please correct me if it was a wrong idea.

Thank you for your time reviewing the PR 🙏

lancelote added 2 commits May 9, 2020 13:57
bytes parametrize parameters cause error when --setup-show is used
and Python is called with -bb flag

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for tackling this @lancelote. I left some comments.

Comment thread changelog/7126.bugfix.rst Outdated
Comment thread src/_pytest/setuponly.py Outdated
Comment thread changelog/7126.bugfix.rst Outdated
Comment thread testing/test_setuponly.py Outdated
@lancelote lancelote marked this pull request as draft May 10, 2020 09:15
@lancelote

lancelote commented May 10, 2020

Copy link
Copy Markdown
Contributor Author

GitLab is down so linting can't succeed, unfortunately.

Changes after the review:

  • Reword changelog entry to hide internal details
  • Rename test to better suit the actual fix
  • Reference issue ID in the test
  • Unconditionally use saferepr for all types
  • Adjust setuponly tests to match the previous change

@bluetech Thank you for the valuable feedback 🙇🏻‍♂️ Please feel free to point me to any other improvements I can add here.

@lancelote lancelote marked this pull request as ready for review May 10, 2020 10:34

@bluetech bluetech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, LGTM, just a couple nits.

I'll leave this open for a few days to let other chime in if they have an opinion about the change to always use repr (I think it makes sense and even in the str case makes it clearer), then I'll merge.

Comment thread changelog/7126.bugfix.rst Outdated
Comment thread testing/test_setuponly.py Outdated
lancelote and others added 2 commits May 10, 2020 16:58
Co-authored-by: Ran Benita <ran@unusedvar.com>
Co-authored-by: Ran Benita <ran@unusedvar.com>
@Zac-HD Zac-HD added topic: reporting related to terminal output and user-facing messages and errors type: bug problem that needs to be addressed labels May 13, 2020

@Zac-HD Zac-HD left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me - let's merge!

Thanks, @lancelote 😁

@bluetech bluetech merged commit 2ac28f6 into pytest-dev:master May 14, 2020
@The-Compiler

Copy link
Copy Markdown
Member

Thanks everyone for the fix! 👍

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

Labels

topic: reporting related to terminal output and user-facing messages and errors type: bug problem that needs to be addressed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants