@@ -129,6 +129,12 @@ class Opts:
129
129
metavar = "OUTFILE" ,
130
130
help = "Write the recorded coverage information to this file. Defaults to '.coverage'"
131
131
)
132
+ input_coverage = optparse .make_option (
133
+ '-c' , '--input-coverage' , action = 'store' , dest = "input_coverage" ,
134
+ metavar = "INPUT" ,
135
+ help = "Read coverage data for report generation from this file (needed if you have "
136
+ "specified -o previously). Defaults to '.coverage'"
137
+ )
132
138
json_pretty_print = optparse .make_option (
133
139
'' , '--pretty-print' , action = 'store_true' ,
134
140
help = "Format the JSON for human readers." ,
@@ -326,6 +332,8 @@ def get_prog_name(self):
326
332
Opts .rcfile ,
327
333
]
328
334
335
+ REPORT_ARGS = [Opts .input_coverage ]
336
+
329
337
CMDS = {
330
338
'annotate' : CmdOptionParser (
331
339
"annotate" ,
@@ -334,7 +342,7 @@ def get_prog_name(self):
334
342
Opts .ignore_errors ,
335
343
Opts .include ,
336
344
Opts .omit ,
337
- ] + GLOBAL_ARGS ,
345
+ ] + REPORT_ARGS + GLOBAL_ARGS ,
338
346
usage = "[options] [modules]" ,
339
347
description = (
340
348
"Make annotated copies of the given files, marking statements that are executed " +
@@ -348,6 +356,7 @@ def get_prog_name(self):
348
356
Opts .append ,
349
357
Opts .keep ,
350
358
Opts .quiet ,
359
+ Opts .output_coverage
351
360
] + GLOBAL_ARGS ,
352
361
usage = "[options] <path1> <path2> ... <pathN>" ,
353
362
description = (
@@ -401,7 +410,7 @@ def get_prog_name(self):
401
410
Opts .no_skip_covered ,
402
411
Opts .skip_empty ,
403
412
Opts .title ,
404
- ] + GLOBAL_ARGS ,
413
+ ] + REPORT_ARGS + GLOBAL_ARGS ,
405
414
usage = "[options] [modules]" ,
406
415
description = (
407
416
"Create an HTML report of the coverage of the files. " +
@@ -422,7 +431,7 @@ def get_prog_name(self):
422
431
Opts .json_pretty_print ,
423
432
Opts .quiet ,
424
433
Opts .show_contexts ,
425
- ] + GLOBAL_ARGS ,
434
+ ] + REPORT_ARGS + GLOBAL_ARGS ,
426
435
usage = "[options] [modules]" ,
427
436
description = "Generate a JSON report of coverage results."
428
437
),
@@ -441,7 +450,7 @@ def get_prog_name(self):
441
450
Opts .skip_covered ,
442
451
Opts .no_skip_covered ,
443
452
Opts .skip_empty ,
444
- ] + GLOBAL_ARGS ,
453
+ ] + REPORT_ARGS + GLOBAL_ARGS ,
445
454
usage = "[options] [modules]" ,
446
455
description = "Report coverage statistics on modules."
447
456
),
@@ -476,7 +485,7 @@ def get_prog_name(self):
476
485
Opts .output_xml ,
477
486
Opts .quiet ,
478
487
Opts .skip_empty ,
479
- ] + GLOBAL_ARGS ,
488
+ ] + REPORT_ARGS + GLOBAL_ARGS ,
480
489
usage = "[options] [modules]" ,
481
490
description = "Generate an XML report of coverage results."
482
491
),
@@ -579,8 +588,7 @@ def command_line(self, argv):
579
588
else :
580
589
concurrency = None
581
590
582
- data_file = options .outfile if options .action in ["run" , "combine" ] \
583
- else getattr (options , "input_coverage" , None )
591
+ data_file = options .outfile if options .action == "run" else None
584
592
# Do something.
585
593
self .coverage = Coverage (
586
594
data_file = data_file or DEFAULT_DATAFILE ,
0 commit comments