9 import os |
9 import os |
10 import os.path |
10 import os.path |
11 import re |
11 import re |
12 |
12 |
13 from coverage.exceptions import ConfigError |
13 from coverage.exceptions import ConfigError |
14 from coverage.misc import contract, isolate_module, substitute_variables |
14 from coverage.misc import contract, isolate_module, human_sorted_items, substitute_variables |
15 |
15 |
16 from coverage.tomlconfig import TomlConfigParser, TomlDecodeError |
16 from coverage.tomlconfig import TomlConfigParser, TomlDecodeError |
17 |
17 |
18 os = isolate_module(os) |
18 os = isolate_module(os) |
19 |
19 |
225 # Defaults for [json] |
225 # Defaults for [json] |
226 self.json_output = "coverage.json" |
226 self.json_output = "coverage.json" |
227 self.json_pretty_print = False |
227 self.json_pretty_print = False |
228 self.json_show_contexts = False |
228 self.json_show_contexts = False |
229 |
229 |
|
230 # Defaults for [lcov] |
|
231 self.lcov_output = "coverage.lcov" |
|
232 |
230 # Defaults for [paths] |
233 # Defaults for [paths] |
231 self.paths = collections.OrderedDict() |
234 self.paths = collections.OrderedDict() |
232 |
235 |
233 # Options for plugins |
236 # Options for plugins |
234 self.plugin_options = {} |
237 self.plugin_options = {} |
395 |
398 |
396 # [json] |
399 # [json] |
397 ('json_output', 'json:output'), |
400 ('json_output', 'json:output'), |
398 ('json_pretty_print', 'json:pretty_print', 'boolean'), |
401 ('json_pretty_print', 'json:pretty_print', 'boolean'), |
399 ('json_show_contexts', 'json:show_contexts', 'boolean'), |
402 ('json_show_contexts', 'json:show_contexts', 'boolean'), |
|
403 |
|
404 # [lcov] |
|
405 ('lcov_output', 'lcov:output'), |
400 ] |
406 ] |
401 |
407 |
402 def _set_attr_from_config_option(self, cp, attr, where, type_=''): |
408 def _set_attr_from_config_option(self, cp, attr, where, type_=''): |
403 """Set an attribute on self if it exists in the ConfigParser. |
409 """Set an attribute on self if it exists in the ConfigParser. |
404 |
410 |
486 self.xml_output = self.post_process_file(self.xml_output) |
492 self.xml_output = self.post_process_file(self.xml_output) |
487 self.paths = collections.OrderedDict( |
493 self.paths = collections.OrderedDict( |
488 (k, [self.post_process_file(f) for f in v]) |
494 (k, [self.post_process_file(f) for f in v]) |
489 for k, v in self.paths.items() |
495 for k, v in self.paths.items() |
490 ) |
496 ) |
|
497 |
|
498 def debug_info(self): |
|
499 """Make a list of (name, value) pairs for writing debug info.""" |
|
500 return human_sorted_items( |
|
501 (k, v) for k, v in self.__dict__.items() if not k.startswith("_") |
|
502 ) |
491 |
503 |
492 |
504 |
493 def config_files_to_try(config_file): |
505 def config_files_to_try(config_file): |
494 """What config files should we try to read? |
506 """What config files should we try to read? |
495 |
507 |