@@ -27,23 +27,25 @@ def pytest_addoption(parser):
2727                    help = 'Select the scope to monitor. By default, only function is monitored.' 
2828                         'Values are function, class, module, session. You can set one or more of these' 
2929                         'by listing them using a comma separated list' )
30-     group .addoption ('--parametrization-explicit' , dest = 'want_explicit_ids ' , action = 'store_true' ,
30+     group .addoption ('--parametrization-explicit' , dest = 'mtr_want_explicit_ids ' , action = 'store_true' ,
3131                    help = 'Set this option to distinguish parametrized tests given their values.' 
3232                         ' This requires the parameters to be stringifiable.' )
3333    group .addoption ('--no-monitor' , action = 'store_true' , dest = 'mtr_none' , help = 'Disable all traces' )
34-     group .addoption ('--remote' , action = 'store' , dest = 'remote ' ,
34+     group .addoption ('--remote' , action = 'store' , dest = 'mtr_remote ' ,
3535                    help = 'Remote server to send the results to. Format is <ADRESS>:<PORT>' )
3636    group .addoption ('--db' , action = 'store' , dest = 'mtr_db_out' , default = '.pymon' ,
3737                    help = 'Use the given sqlite database for storing results.' )
38-     group .addoption ('--no-db' , action = 'store_true' , help = 'Do not store results in local db.' )
39-     group .addoption ('--force-component' , action = 'store' ,
38+     group .addoption ('--no-db' , action = 'store_true' , dest = 'mtr_no_db' ,  help = 'Do not store results in local db.' )
39+     group .addoption ('--force-component' , action = 'store' ,  dest = 'mtr_force_component' ,  
4040                    help = 'Force the component to be set at the given value for the all tests run' 
4141                         ' in this session.' )
42-     group .addoption ('--component-prefix' , action = 'store' ,
42+     group .addoption ('--component-prefix' , action = 'store' ,  dest = 'mtr_component_prefix' , 
4343                    help = 'Prefix each found components with the given value (applies to all tests' 
4444                         ' run in this session).' )
45-     group .addoption ('--description' , action = 'store' , default = '' ,
45+     group .addoption ('--description' , action = 'store' , default = '' ,  dest = 'mtr_description' , 
4646                    help = 'Use this option to provide a small summary about this run.' )
47+     group .addoption ('--tag' , action = 'append' , dest = 'mtr_tags' , default = [],
48+                     help = 'Provide meaningfull flags to your run. This can help you in your analysis.' )
4749
4850
4951def  pytest_configure (config ):
@@ -143,7 +145,7 @@ def prof():
143145
144146
145147def  pytest_make_parametrize_id (config , val , argname ):
146-     if  config .option .want_explicit_ids :
148+     if  config .option .mtr_want_explicit_ids :
147149        return  f'{ argname }  ={ val }  ' 
148150
149151
@@ -153,22 +155,23 @@ def pytest_sessionstart(session):
153155    Instantiate a monitor session to save collected metrics. 
154156    We yield at the end to let pytest pursue the execution. 
155157    """ 
156-     if  session .config .option .force_component  and  session .config .option .component_prefix :
158+     if  session .config .option .mtr_force_component  and  session .config .option .mtr_component_prefix :
157159        raise  pytest .UsageError ('Invalid usage: --force-component and --component-prefix are incompatible options!' )
158-     if  session .config .option .no_db  and  not  session .config .option .remote  and  not  session .config .option .mtr_none :
160+     if  session .config .option .mtr_no_db  and  not  session .config .option .mtr_remote  and  not  session .config .option .mtr_none :
159161        warnings .warn ('pytest-monitor: No storage specified but monitoring is requested. Disabling monitoring.' )
160162        session .config .option .mtr_none  =  True 
161-     component  =  session .config .option .force_component  or  session .config .option .component_prefix  
162-     if  session .config .option .component_prefix :
163+     component  =  session .config .option .mtr_force_component  or  session .config .option .mtr_component_prefix  
164+     if  session .config .option .mtr_component_prefix :
163165        component  +=  '.{user_component}' 
164166    if  not  component :
165167        component  =  '{user_component}' 
166-     db  =  None  if  (session .config .option .mtr_none  or  session .config .option .no_db ) else  session .config .option .mtr_db_out 
167-     remote  =  None  if  session .config .option .mtr_none  else  session .config .option .remote 
168+     db  =  None  if  (session .config .option .mtr_none  or  session .config .option .mtr_no_db ) else  session .config .option .mtr_db_out 
169+     remote  =  None  if  session .config .option .mtr_none  else  session .config .option .mtr_remote 
168170    session .pytest_monitor  =  PyTestMonitorSession (db = db , remote = remote ,
169171                                                  component = component ,
170172                                                  scope = session .config .option .mtr_scope )
171-     session .pytest_monitor .compute_info (session .config .option .description )
173+     session .pytest_monitor .compute_info (session .config .option .mtr_description ,
174+                                         session .config .option .mtr_tags )
172175    yield 
173176
174177
0 commit comments