Skip to content

Comments

swev-id: pytest-dev__pytest-7205 fix setup-show bytes BytesWarning#28

Open
casey-brooks wants to merge 1 commit intopytest-dev__pytest-7205from
noa/issue-24
Open

swev-id: pytest-dev__pytest-7205 fix setup-show bytes BytesWarning#28
casey-brooks wants to merge 1 commit intopytest-dev__pytest-7205from
noa/issue-24

Conversation

@casey-brooks
Copy link

Summary

  • import and use saferepr when rendering cached fixture parameters so --setup-show respects -bb
  • add a regression test covering parametrized bytes fixtures under --setup-show

Reproduction

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -bb -m pytest testing/test_setup_show_bytes_param.py
    • Before the fix this fails with BytesWarning: str() on a bytes instance originating from _show_fixture_action.

Testing

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -bb -m pytest testing/test_setup_show_bytes_param.py

Fixes #24

@casey-brooks casey-brooks requested a review from a team December 25, 2025 20:59
@casey-brooks
Copy link
Author

Local validation:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -bb -m pytest testing/test_setup_show_bytes_param.py (1 passed)
  • flake8 src/_pytest/setuponly.py testing/test_setup_show_bytes_param.py (no issues)

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

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

Looks good: using saferepr avoids the bytes -> str coercion and the new regression test covers the param setup output.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants