Init config args and args_source
This commit is contained in:
parent
00c8beab45
commit
72918bc050
|
@ -998,6 +998,7 @@ class Config:
|
||||||
self.hook.pytest_addoption.call_historic(
|
self.hook.pytest_addoption.call_historic(
|
||||||
kwargs=dict(parser=self._parser, pluginmanager=self.pluginmanager)
|
kwargs=dict(parser=self._parser, pluginmanager=self.pluginmanager)
|
||||||
)
|
)
|
||||||
|
self.args_source = Config.ArgsSource.ARGS
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from _pytest.cacheprovider import Cache
|
from _pytest.cacheprovider import Cache
|
||||||
|
@ -1368,7 +1369,7 @@ class Config:
|
||||||
self.args = args
|
self.args = args
|
||||||
self.args_source = source
|
self.args_source = source
|
||||||
except PrintHelp:
|
except PrintHelp:
|
||||||
pass
|
self.args = []
|
||||||
|
|
||||||
def issue_config_time_warning(self, warning: Warning, stacklevel: int) -> None:
|
def issue_config_time_warning(self, warning: Warning, stacklevel: int) -> None:
|
||||||
"""Issue and handle a warning during the "configure" stage.
|
"""Issue and handle a warning during the "configure" stage.
|
||||||
|
|
|
@ -619,7 +619,7 @@ class Session(nodes.FSCollector):
|
||||||
and ``session.items`` is empty.
|
and ``session.items`` is empty.
|
||||||
"""
|
"""
|
||||||
if args is None:
|
if args is None:
|
||||||
args = self.config.args if hasattr(self.config, "args") else ()
|
args = self.config.args
|
||||||
|
|
||||||
self.trace("perform_collect", self, args)
|
self.trace("perform_collect", self, args)
|
||||||
self.trace.root.indent += 1
|
self.trace.root.indent += 1
|
||||||
|
|
|
@ -737,10 +737,8 @@ class TerminalReporter:
|
||||||
|
|
||||||
if config.inipath:
|
if config.inipath:
|
||||||
line += ", configfile: " + bestrelpath(config.rootpath, config.inipath)
|
line += ", configfile: " + bestrelpath(config.rootpath, config.inipath)
|
||||||
if (
|
|
||||||
hasattr(config, "args_source")
|
if config.args_source == Config.ArgsSource.TESTPATHS:
|
||||||
and config.args_source == Config.ArgsSource.TESTPATHS
|
|
||||||
):
|
|
||||||
testpaths: List[str] = config.getini("testpaths")
|
testpaths: List[str] = config.getini("testpaths")
|
||||||
line += ", testpaths: {}".format(", ".join(testpaths))
|
line += ", testpaths: {}".format(", ".join(testpaths))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue