@@ -96,7 +96,9 @@ def pytest_sessionstart(session):
9696 session .config .py_test_service .start_launch (
9797 session .config .option .rp_launch ,
9898 attributes = attributes ,
99- description = session .config .option .rp_launch_description
99+ description = session .config .option .rp_launch_description ,
100+ rerun = session .config .option .rp_rerun ,
101+ rerun_of = session .config .option .rp_rerun_of
100102 )
101103 if session .config .pluginmanager .hasplugin ('xdist' ):
102104 wait_launch (session .config .py_test_service .rp )
@@ -185,12 +187,21 @@ def pytest_configure(config):
185187
186188 if not config .option .rp_launch :
187189 config .option .rp_launch = config .getini ('rp_launch' )
190+
188191 if not config .option .rp_launch_description :
189192 config .option .rp_launch_description = config .\
190193 getini ('rp_launch_description' )
191194 if not config .option .rp_launch_id :
192195 config .option .rp_launch_id = config .getini ('rp_launch_id' )
193196
197+ if not config .option .rp_rerun_of :
198+ config .option .rp_rerun_of = config .getini ('rp_rerun_of' )
199+ if config .option .rp_rerun_of :
200+ config .option .rp_rerun = True
201+ else :
202+ if not config .option .rp_rerun :
203+ config .option .rp_rerun = config .getini ('rp_rerun' )
204+
194205 if is_master (config ):
195206 config .py_test_service = PyTestServiceClass ()
196207 else :
@@ -257,7 +268,17 @@ def pytest_addoption(parser):
257268 dest = 'rp_launch_description' ,
258269 help = 'Launch description (overrides '
259270 'rp_launch_description config option)' )
260-
271+ group .addoption (
272+ '--rp-rerun' ,
273+ action = 'store_true' ,
274+ dest = 'rp_rerun' ,
275+ help = 'Marks the launch as the rerun' )
276+ group .addoption (
277+ '--rp-rerun-of' ,
278+ action = 'store' ,
279+ dest = 'rp_rerun_of' ,
280+ help = 'ID of the launch to be marked as a rerun '
281+ '(use only with rp_rerun=True)' )
261282 group .addoption (
262283 '--reportportal' ,
263284 action = 'store_true' ,
@@ -401,3 +422,14 @@ def pytest_addoption(parser):
401422 'retries' ,
402423 default = '0' ,
403424 help = 'Amount of retries for performing REST calls to RP server' )
425+
426+ parser .addini (
427+ 'rp_rerun' ,
428+ default = False ,
429+ help = 'Marks the launch as the rerun' )
430+
431+ parser .addini (
432+ 'rp_rerun_of' ,
433+ default = '' ,
434+ help = 'ID of the launch to be marked as a rerun '
435+ '(use only with rp_rerun=True)' )
0 commit comments