Skip to content

Commit 3a8d401

Browse files
committed
test(--no-showlocals): Should hide locals when addopts=--showlocals
1 parent 2b6622f commit 3a8d401

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

testing/test_terminal.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,22 @@ def test_showlocals():
998998
]
999999
)
10001000

1001+
def test_noshowlocals_addopts_override(self, pytester: Pytester) -> None:
1002+
pytester.makeini("[pytest]\naddopts=--showlocals")
1003+
p1 = pytester.makepyfile(
1004+
"""
1005+
def test_noshowlocals():
1006+
x = 3
1007+
y = "x" * 5000
1008+
assert 0
1009+
"""
1010+
)
1011+
1012+
# Override global --showlocals for py.test via arg
1013+
result = pytester.runpytest(p1, "--no-showlocals")
1014+
result.stdout.no_fnmatch_line("x* = 3")
1015+
result.stdout.no_fnmatch_line("y* = 'xxxxxx*")
1016+
10011017
def test_showlocals_short(self, pytester: Pytester) -> None:
10021018
p1 = pytester.makepyfile(
10031019
"""

0 commit comments

Comments
 (0)