test(--no-showlocals): Should hide locals when addopts=--showlocals

This commit is contained in:
Tony Narlock 2022-10-14 16:20:33 -05:00
parent 2b6622fdd3
commit 3a8d401ac7
1 changed files with 16 additions and 0 deletions

View File

@ -998,6 +998,22 @@ class TestTerminalFunctional:
]
)
def test_noshowlocals_addopts_override(self, pytester: Pytester) -> None:
pytester.makeini("[pytest]\naddopts=--showlocals")
p1 = pytester.makepyfile(
"""
def test_noshowlocals():
x = 3
y = "x" * 5000
assert 0
"""
)
# Override global --showlocals for py.test via arg
result = pytester.runpytest(p1, "--no-showlocals")
result.stdout.no_fnmatch_line("x* = 3")
result.stdout.no_fnmatch_line("y* = 'xxxxxx*")
def test_showlocals_short(self, pytester: Pytester) -> None:
p1 = pytester.makepyfile(
"""