@@ -76,8 +76,11 @@ def pytest_configure(config):
7676
7777
7878def raise_on_kwargs (kwargs ):
79+ __tracebackhide__ = True
7980 if kwargs :
80- raise TypeError ("Unexpected arguments: {}" .format (", " .join (sorted (kwargs ))))
81+ raise TypeError (
82+ "Unexpected keyword arguments: {}" .format (", " .join (sorted (kwargs )))
83+ )
8184
8285
8386class LsofFdLeakChecker (object ):
@@ -803,12 +806,15 @@ def inline_run(self, *args, **kwargs):
803806
804807 :param args: command line arguments to pass to :py:func:`pytest.main`
805808
806- :param plugin : (keyword-only) extra plugin instances the
809+ :param plugins : (keyword-only) extra plugin instances the
807810 ``pytest.main()`` instance should use
808811
809812 :return: a :py:class:`HookRecorder` instance
810-
811813 """
814+ plugins = kwargs .pop ("plugins" , [])
815+ no_reraise_ctrlc = kwargs .pop ("no_reraise_ctrlc" , None )
816+ raise_on_kwargs (kwargs )
817+
812818 finalizers = []
813819 try :
814820 # Do not load user config (during runs only).
@@ -848,7 +854,6 @@ class Collect(object):
848854 def pytest_configure (x , config ):
849855 rec .append (self .make_hook_recorder (config .pluginmanager ))
850856
851- plugins = kwargs .get ("plugins" ) or []
852857 plugins .append (Collect ())
853858 ret = pytest .main (list (args ), plugins = plugins )
854859 if len (rec ) == 1 :
@@ -862,7 +867,7 @@ class reprec(object):
862867
863868 # typically we reraise keyboard interrupts from the child run
864869 # because it's our user requesting interruption of the testing
865- if ret == EXIT_INTERRUPTED and not kwargs . get ( " no_reraise_ctrlc" ) :
870+ if ret == EXIT_INTERRUPTED and not no_reraise_ctrlc :
866871 calls = reprec .getcalls ("pytest_keyboard_interrupt" )
867872 if calls and calls [- 1 ].excinfo .type == KeyboardInterrupt :
868873 raise KeyboardInterrupt ()
@@ -874,9 +879,10 @@ class reprec(object):
874879 def runpytest_inprocess (self , * args , ** kwargs ):
875880 """Return result of running pytest in-process, providing a similar
876881 interface to what self.runpytest() provides.
877-
878882 """
879- if kwargs .get ("syspathinsert" ):
883+ syspathinsert = kwargs .pop ("syspathinsert" , False )
884+
885+ if syspathinsert :
880886 self .syspathinsert ()
881887 now = time .time ()
882888 capture = MultiCapture (Capture = SysCapture )
@@ -1201,9 +1207,10 @@ def runpytest_subprocess(self, *args, **kwargs):
12011207 :py:class:`Testdir.TimeoutExpired`
12021208
12031209 Returns a :py:class:`RunResult`.
1204-
12051210 """
12061211 __tracebackhide__ = True
1212+ timeout = kwargs .pop ("timeout" , None )
1213+ raise_on_kwargs (kwargs )
12071214
12081215 p = py .path .local .make_numbered_dir (
12091216 prefix = "runpytest-" , keep = None , rootdir = self .tmpdir
@@ -1213,7 +1220,7 @@ def runpytest_subprocess(self, *args, **kwargs):
12131220 if plugins :
12141221 args = ("-p" , plugins [0 ]) + args
12151222 args = self ._getpytestargs () + args
1216- return self .run (* args , timeout = kwargs . get ( " timeout" ) )
1223+ return self .run (* args , timeout = timeout )
12171224
12181225 def spawn_pytest (self , string , expect_timeout = 10.0 ):
12191226 """Run pytest using pexpect.
0 commit comments