@@ -70,6 +70,8 @@ def main(args=None, plugins=None):
70
70
tw .line (line .rstrip (), red = True )
71
71
return 4
72
72
else :
73
+ config .invocation_args = args
74
+ config .invocation_plugins = plugins
73
75
try :
74
76
return config .hook .pytest_cmdline_main (config = config )
75
77
finally :
@@ -608,20 +610,33 @@ def _iter_rewritable_modules(package_files):
608
610
609
611
610
612
class Config :
611
- """ access to configuration values, pluginmanager and plugin hooks. """
613
+ """
614
+ Access to configuration values, pluginmanager and plugin hooks.
615
+
616
+ :ivar PytestPluginManager pluginmanager: the plugin manager handles plugin registration and hook invocation.
617
+
618
+ :ivar argparse.Namespace option: access to command line option as attributes.
619
+
620
+ :ivar invocation_args: list of command-line arguments as passed to pytest.main()
621
+
622
+ :ivar invocation_plugins: list of extra plugins passed to pytest.main(), might be None
623
+
624
+ :ivar py.path.local invocation_dir: directory where pytest.main() was invoked from
625
+ """
612
626
613
627
def __init__ (self , pluginmanager ):
614
- #: access to command line option as attributes.
615
- #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead
616
- self .option = argparse .Namespace ()
617
628
from .argparsing import Parser , FILE_OR_DIR
618
629
630
+ self .option = argparse .Namespace ()
631
+ self .invocation_args = None
632
+ self .invocation_plugins = None
633
+ self .invocation_dir = py .path .local ()
634
+
619
635
_a = FILE_OR_DIR
620
636
self ._parser = Parser (
621
637
usage = "%(prog)s [options] [{}] [{}] [...]" .format (_a , _a ),
622
638
processopt = self ._processopt ,
623
639
)
624
- #: a pluginmanager instance
625
640
self .pluginmanager = pluginmanager
626
641
self .trace = self .pluginmanager .trace .root .get ("config" )
627
642
self .hook = self .pluginmanager .hook
@@ -631,7 +646,6 @@ def __init__(self, pluginmanager):
631
646
self ._cleanup = []
632
647
self .pluginmanager .register (self , "pytestconfig" )
633
648
self ._configured = False
634
- self .invocation_dir = py .path .local ()
635
649
self .hook .pytest_addoption .call_historic (kwargs = dict (parser = self ._parser ))
636
650
637
651
def add_cleanup (self , func ):
0 commit comments