Skip to content

Commit

Permalink
Fix crash when passing a very long cmdline argument
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Sep 7, 2023
1 parent e787d2e commit 6536514
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions testing/test_main.py
Expand Up @@ -262,3 +262,27 @@ def test(fix):
"* 1 passed in *",
]
)


def test_very_long_cmdline_arg(pytester: Pytester) -> None:
pytester.makeconftest(
"""
import pytest
def pytest_addoption(parser):
parser.addoption("--long-list", dest="long_list", action="store", default="all", help="List of things")
@pytest.fixture(scope="module")
def specified_feeds(request):
list_string = request.config.getoption("--long-list")
return list_string.split(',')
"""
)
pytester.makepyfile(
"""
def test_foo(specified_feeds):
assert len(specified_feeds) == 100_000
"""
)
result = pytester.runpytest("--long-list", ",".join(["helloworld"] * 100_000))
result.stdout.fnmatch_lines("* 1 passed *")

0 comments on commit 6536514

Please sign in to comment.