24
24
logger .setLevel (logging .DEBUG )
25
25
26
26
27
+ # pylint: disable-next=too-many-arguments
27
28
def run_tox_command (
28
29
project_dir : PosixPath ,
29
30
env_name : Optional [str ],
31
+ label_name : Optional [str ],
30
32
config_file : Optional [PosixPath ],
31
33
env_vars : Optional [dict [Any , Any ]],
32
34
extra_args : list [str ],
@@ -35,6 +37,7 @@ def run_tox_command(
35
37
36
38
:param project_dir: The location of the project containing tox.ini file.
37
39
:param env_name: An optional tox env name.
40
+ :param label_name: An optional tox label name.
38
41
:param config_file: An optional tox configuration file.
39
42
:param env_vars: An optional dictionary of environment to set when running command.
40
43
:param extra_args: Tox extra args.
@@ -43,6 +46,8 @@ def run_tox_command(
43
46
tox_cmd = ["tox" ]
44
47
if env_name :
45
48
tox_cmd .extend (["-e" , env_name ])
49
+ if label_name :
50
+ tox_cmd .extend (["-m" , label_name ])
46
51
if config_file :
47
52
tox_cmd .extend (["-c" , str (config_file )])
48
53
if extra_args :
@@ -320,12 +325,15 @@ def main() -> None:
320
325
parser .add_argument (
321
326
"--tox-config-file" , type = PosixPath , help = "the location of the tox configuration file"
322
327
)
323
- parser .add_argument ("--tox-envname" , help = "the tox env name. e.g: env1=value1\n env2=value2" )
328
+ parser .add_argument ("--tox-envname" , help = "the tox env name." )
329
+ parser .add_argument ("--tox-labelname" , help = "the tox label name." )
324
330
parser .add_argument (
325
331
"--tox-project-dir" , default = "." , help = "the location of the project containing tox.ini file"
326
332
)
327
333
parser .add_argument (
328
- "--tox-env-vars" , default = "" , help = "the environment to set when running tox command."
334
+ "--tox-env-vars" ,
335
+ default = "" ,
336
+ help = "the environment to set when running tox command. e.g: env1=value1\n env2=value2" ,
329
337
)
330
338
parser .add_argument (
331
339
"--tox-constraints-file" , type = PosixPath , help = "the location to the tox constraints file."
@@ -352,13 +360,23 @@ def main() -> None:
352
360
if tox_extra_args :
353
361
extra_args .append (tox_extra_args )
354
362
run_tox_command (
355
- args .tox_project_dir , args .tox_envname , args .tox_config_file , tox_environment , extra_args
363
+ args .tox_project_dir ,
364
+ args .tox_envname ,
365
+ args .tox_labelname ,
366
+ args .tox_config_file ,
367
+ tox_environment ,
368
+ extra_args ,
356
369
)
357
370
358
371
# show environment config
359
372
extra_args = ["--showconfig" ]
360
373
tox_raw_config = run_tox_command (
361
- args .tox_project_dir , args .tox_envname , args .tox_config_file , tox_environment , extra_args
374
+ args .tox_project_dir ,
375
+ args .tox_envname ,
376
+ args .tox_labelname ,
377
+ args .tox_config_file ,
378
+ tox_environment ,
379
+ extra_args ,
362
380
)
363
381
logger .info ("Show config => %s" , tox_raw_config )
364
382
0 commit comments