@@ -76,8 +76,11 @@ def pytest_configure(config):
76
76
77
77
78
78
def raise_on_kwargs (kwargs ):
79
+ __tracebackhide__ = True
79
80
if kwargs :
80
- raise TypeError ("Unexpected arguments: {}" .format (", " .join (sorted (kwargs ))))
81
+ raise TypeError (
82
+ "Unexpected keyword arguments: {}" .format (", " .join (sorted (kwargs )))
83
+ )
81
84
82
85
83
86
class LsofFdLeakChecker (object ):
@@ -803,12 +806,15 @@ def inline_run(self, *args, **kwargs):
803
806
804
807
:param args: command line arguments to pass to :py:func:`pytest.main`
805
808
806
- :param plugin : (keyword-only) extra plugin instances the
809
+ :param plugins : (keyword-only) extra plugin instances the
807
810
``pytest.main()`` instance should use
808
811
809
812
:return: a :py:class:`HookRecorder` instance
810
-
811
813
"""
814
+ plugins = kwargs .pop ("plugins" , [])
815
+ no_reraise_ctrlc = kwargs .pop ("no_reraise_ctrlc" , None )
816
+ raise_on_kwargs (kwargs )
817
+
812
818
finalizers = []
813
819
try :
814
820
# Do not load user config (during runs only).
@@ -848,7 +854,6 @@ class Collect(object):
848
854
def pytest_configure (x , config ):
849
855
rec .append (self .make_hook_recorder (config .pluginmanager ))
850
856
851
- plugins = kwargs .get ("plugins" ) or []
852
857
plugins .append (Collect ())
853
858
ret = pytest .main (list (args ), plugins = plugins )
854
859
if len (rec ) == 1 :
@@ -862,7 +867,7 @@ class reprec(object):
862
867
863
868
# typically we reraise keyboard interrupts from the child run
864
869
# 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 :
866
871
calls = reprec .getcalls ("pytest_keyboard_interrupt" )
867
872
if calls and calls [- 1 ].excinfo .type == KeyboardInterrupt :
868
873
raise KeyboardInterrupt ()
@@ -874,9 +879,10 @@ class reprec(object):
874
879
def runpytest_inprocess (self , * args , ** kwargs ):
875
880
"""Return result of running pytest in-process, providing a similar
876
881
interface to what self.runpytest() provides.
877
-
878
882
"""
879
- if kwargs .get ("syspathinsert" ):
883
+ syspathinsert = kwargs .pop ("syspathinsert" , False )
884
+
885
+ if syspathinsert :
880
886
self .syspathinsert ()
881
887
now = time .time ()
882
888
capture = MultiCapture (Capture = SysCapture )
@@ -1201,9 +1207,10 @@ def runpytest_subprocess(self, *args, **kwargs):
1201
1207
:py:class:`Testdir.TimeoutExpired`
1202
1208
1203
1209
Returns a :py:class:`RunResult`.
1204
-
1205
1210
"""
1206
1211
__tracebackhide__ = True
1212
+ timeout = kwargs .pop ("timeout" , None )
1213
+ raise_on_kwargs (kwargs )
1207
1214
1208
1215
p = py .path .local .make_numbered_dir (
1209
1216
prefix = "runpytest-" , keep = None , rootdir = self .tmpdir
@@ -1213,7 +1220,7 @@ def runpytest_subprocess(self, *args, **kwargs):
1213
1220
if plugins :
1214
1221
args = ("-p" , plugins [0 ]) + args
1215
1222
args = self ._getpytestargs () + args
1216
- return self .run (* args , timeout = kwargs . get ( " timeout" ) )
1223
+ return self .run (* args , timeout = timeout )
1217
1224
1218
1225
def spawn_pytest (self , string , expect_timeout = 10.0 ):
1219
1226
"""Run pytest using pexpect.
0 commit comments