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