@@ -1246,19 +1246,18 @@ def pytest_load_initial_conftests(self, early_config: Config) -> None:
12461246 ),
12471247 )
12481248
1249- def _consider_importhook (self , args : Sequence [ str ] ) -> None :
1249+ def _consider_importhook (self ) -> None :
12501250 """Install the PEP 302 import hook if using assertion rewriting.
12511251
12521252 Needs to parse the --assert=<mode> option from the commandline
12531253 and find all the installed plugins to mark them for rewriting
12541254 by the importhook.
12551255 """
1256- ns = self ._parser .parse_known_args (args )
1257- mode = getattr (ns , "assertmode" , "plain" )
1256+ mode = getattr (self .known_args_namespace , "assertmode" , "plain" )
12581257
1259- disable_autoload = getattr (ns , "disable_plugin_autoload" , False ) or bool (
1260- os . environ . get ( "PYTEST_DISABLE_PLUGIN_AUTOLOAD" )
1261- )
1258+ disable_autoload = getattr (
1259+ self . known_args_namespace , "disable_plugin_autoload" , False
1260+ ) or bool ( os . environ . get ( "PYTEST_DISABLE_PLUGIN_AUTOLOAD" ))
12621261 if mode == "rewrite" :
12631262 import _pytest .assertion
12641263
@@ -1406,7 +1405,7 @@ def _preparse(self, args: list[str], addopts: bool = True) -> None:
14061405 args , namespace = copy .copy (self .option )
14071406 )
14081407 self ._checkversion ()
1409- self ._consider_importhook (args )
1408+ self ._consider_importhook ()
14101409 self ._configure_python_path ()
14111410 self .pluginmanager .consider_preparse (args , exclude_only = False )
14121411 if (
0 commit comments