Skip to content

Commit 2fb06f2

Browse files
committed
Fix crash when passing a very long cmdline argument
Fixes #11394
1 parent e787d2e commit 2fb06f2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

testing/test_main.py

+24
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,27 @@ def test(fix):
262262
"* 1 passed in *",
263263
]
264264
)
265+
266+
267+
def test_very_long_cmdline_arg(pytester: Pytester) -> None:
268+
pytester.makeconftest(
269+
"""
270+
import pytest
271+
272+
def pytest_addoption(parser):
273+
parser.addoption("--long-list", dest="long_list", action="store", default="all", help="List of things")
274+
275+
@pytest.fixture(scope="module")
276+
def specified_feeds(request):
277+
list_string = request.config.getoption("--long-list")
278+
return list_string.split(',')
279+
"""
280+
)
281+
pytester.makepyfile(
282+
"""
283+
def test_foo(specified_feeds):
284+
assert len(specified_feeds) == 100
285+
"""
286+
)
287+
result = pytester.runpytest("--long-list", ",".join(["helloworld"] * 100))
288+
result.stdout.fnmatch_lines("* 1 passed *")

0 commit comments

Comments
 (0)