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 274990a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions testing/test_terminal.py
Expand Up @@ -1018,6 +1018,27 @@ def test_showlocals_short():
]
)

def test_noshowlocals_addopts_override(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.fnmatch_lines(
[
# "_ _ * Locals *",
"x* = 3",
"y* = 'xxxxxx*",
]
)

@pytest.fixture
def verbose_testfile(self, pytester: Pytester) -> Path:
return pytester.makepyfile(
Expand Down

0 comments on commit 274990a

Please sign in to comment.