Fix #7126 - saferepr for bytes params
bytes parametrize parameters cause error when --setup-show is used and Python is called with -bb flag
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pytest
|
||||
from _pytest._io.saferepr import saferepr
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -66,7 +67,11 @@ def _show_fixture_action(fixturedef, msg):
|
||||
tw.write(" (fixtures used: {})".format(", ".join(deps)))
|
||||
|
||||
if hasattr(fixturedef, "cached_param"):
|
||||
tw.write("[{}]".format(fixturedef.cached_param))
|
||||
if isinstance(fixturedef.cached_param, bytes):
|
||||
param = saferepr(fixturedef.cached_param, maxsize=42)
|
||||
else:
|
||||
param = fixturedef.cached_param
|
||||
tw.write("[{}]".format(param))
|
||||
|
||||
tw.flush()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user