Skip to content

Commit

Permalink
test(--no-showlocals): Should hide locals when addopts=--showlocals
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Oct 14, 2022
1 parent 2b6622f commit 3a8d401
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions testing/test_terminal.py
Expand Up @@ -998,6 +998,22 @@ def test_showlocals():
]
)

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(
"""
Expand Down

0 comments on commit 3a8d401

Please sign in to comment.