11"""
22Test case for issue #13817: AttributeError with invalid flag in pytest_addoption
33"""
4-
54from __future__ import annotations
65
6+ import pytest
7+
78from _pytest .config .argparsing import ArgumentError
89from _pytest .config .argparsing import Parser
9- import pytest
1010
1111
1212# Suppress warning about using private pytest API (we're testing pytest itself)
1313@pytest .mark .filterwarnings ("ignore::pytest.PytestDeprecationWarning" )
1414class TestArgumentReprFix :
1515 """Test that Argument.__repr__ handles missing dest attribute."""
1616
17- def test_invalid_option_without_dashes (self ):
17+ def test_invalid_option_without_dashes (self ) -> None :
1818 """Test that invalid option names produce helpful error messages."""
1919 parser = Parser ()
2020
@@ -30,7 +30,7 @@ def test_invalid_option_without_dashes(self):
3030 assert "AttributeError" not in error_message
3131 assert "has no attribute 'dest'" not in error_message
3232
33- def test_invalid_short_option (self ):
33+ def test_invalid_short_option (self ) -> None :
3434 """Test that invalid short option names produce helpful error messages."""
3535 parser = Parser ()
3636
@@ -44,11 +44,11 @@ def test_invalid_short_option(self):
4444 or "invalid short option string" in error_message
4545 )
4646
47- def test_valid_option_works (self ):
47+ def test_valid_option_works (self ) -> None :
4848 """Test that valid options still work correctly."""
4949 parser = Parser ()
5050 parser .addoption ("--shuffle" , action = "store_true" , help = "Shuffle tests" )
5151
5252 options = parser ._anonymous .options
5353 assert len (options ) > 0
54- assert "--shuffle" in options [0 ].names ()
54+ assert "--shuffle" in options [0 ].names ()
0 commit comments