diff options
author | Ned Batchelder <nedbat@gmail.com> | 2014-07-05 07:26:30 -0400 |
---|---|---|
committer | Ned Batchelder <nedbat@gmail.com> | 2014-07-05 07:26:30 -0400 |
commit | dcaa0ae12a1ad2545d53204d1809ac439b394b6d (patch) | |
tree | bfc00cff86262ccfaa2f36e56ddb537146d9fb32 /coverage/config.py | |
parent | 4cc85293e42efc262d9e7224435bbbc3afb1596b (diff) | |
parent | 3d697b2583ceb8c6267ba82d8573686e44b9b71b (diff) | |
download | python-coveragepy-dcaa0ae12a1ad2545d53204d1809ac439b394b6d.tar.gz |
Merged in asottile/coverage.py/fix_source_encoding (pull request #38)
Fix non-comment encoding detection.
Diffstat (limited to 'coverage/config.py')
-rw-r--r-- | coverage/config.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/coverage/config.py b/coverage/config.py index 60ec3f4..e5e3585 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -21,6 +21,15 @@ class HandyConfigParser(configparser.RawConfigParser): return configparser.RawConfigParser.read(self, filename, **kwargs) def get(self, *args, **kwargs): + """Get a value, replacing environment variables also. + + The arguments are the same as `RawConfigParser.get`, but in the found + value, ``$WORD`` or ``${WORD}`` are replaced by the value of the + environment variable ``WORD``. + + Returns the finished value. + + """ v = configparser.RawConfigParser.get(self, *args, **kwargs) def dollar_replace(m): """Called for each $replacement.""" @@ -113,6 +122,7 @@ class CoverageConfig(object): self.timid = False self.source = None self.debug = [] + self.extensions = [] # Defaults for [report] self.exclude_list = DEFAULT_EXCLUDE[:] @@ -144,7 +154,7 @@ class CoverageConfig(object): if env: self.timid = ('--timid' in env) - MUST_BE_LIST = ["omit", "include", "debug"] + MUST_BE_LIST = ["omit", "include", "debug", "extensions"] def from_args(self, **kwargs): """Read config values from `kwargs`.""" @@ -176,12 +186,21 @@ class CoverageConfig(object): self.paths[option] = cp.getlist('paths', option) CONFIG_FILE_OPTIONS = [ + # These are *args for set_attr_from_config_option: + # (attr, where, type_="") + # + # attr is the attribute to set on the CoverageConfig object. + # where is the section:name to read from the configuration file. + # type_ is the optional type to apply, by using .getTYPE to read the + # configuration value from the file. + # [run] ('branch', 'run:branch', 'boolean'), ('coroutine', 'run:coroutine'), ('cover_pylib', 'run:cover_pylib', 'boolean'), ('data_file', 'run:data_file'), ('debug', 'run:debug', 'list'), + ('extensions', 'run:extensions', 'list'), ('include', 'run:include', 'list'), ('omit', 'run:omit', 'list'), ('parallel', 'run:parallel', 'boolean'), |