Skip to content

Commit 44f4bea

Browse files
authored
Fix CI for pytest 9.0+ (#1272)
1 parent 9524247 commit 44f4bea

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

testing/test_remote.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ def test_mainargv(request):
378378

379379

380380
def test_remote_usage_prog(pytester: pytest.Pytester) -> None:
381+
if pytest.version_tuple[:2] >= (9, 0):
382+
get_optparser_expr = "get_config_parser.optparser"
383+
else:
384+
get_optparser_expr = "get_config_parser._getparser()"
385+
381386
pytester.makeconftest(
382387
"""
383388
import pytest
@@ -394,12 +399,12 @@ def pytest_configure(config):
394399
"""
395400
)
396401
pytester.makepyfile(
397-
"""
402+
f"""
398403
import sys
399404
400405
def test(get_config_parser, request):
401-
get_config_parser._getparser().error("my_usage_error")
402-
"""
406+
{get_optparser_expr}.error("my_usage_error")
407+
"""
403408
)
404409

405410
result = pytester.runpytest_subprocess("-n1")

0 commit comments

Comments
 (0)