From 7b5457967f256696d3b6c936e81436aa60b4b409 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 24 Sep 2014 21:03:16 -0400 Subject: "concurrency" is a better name that "coroutine" --HG-- rename : tests/test_coroutine.py => tests/test_concurrency.py --- coverage/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index c671ef75..44bf3930 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -140,7 +140,7 @@ class CoverageConfig(object): # Defaults for [run] self.branch = False - self.coroutine = None + self.concurrency = None self.cover_pylib = False self.data_file = ".coverage" self.parallel = False @@ -235,7 +235,7 @@ class CoverageConfig(object): # [run] ('branch', 'run:branch', 'boolean'), - ('coroutine', 'run:coroutine'), + ('concurrency', 'run:concurrency'), ('cover_pylib', 'run:cover_pylib', 'boolean'), ('data_file', 'run:data_file'), ('debug', 'run:debug', 'list'), -- cgit v1.2.1 From d33fe1f90216e24039d5cbd003219543d1671313 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 28 Sep 2014 18:42:30 -0400 Subject: Remove support for COVERAGE_OPTIONS environment variable. --- coverage/config.py | 9 --------- 1 file changed, 9 deletions(-) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index 44bf3930..ece68ba8 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -173,15 +173,6 @@ class CoverageConfig(object): # Options for plugins self.plugin_options = {} - def from_environment(self, env_var): - """Read configuration from the `env_var` environment variable.""" - # Timidity: for nose users, read an environment variable. This is a - # cheap hack, since the rest of the command line arguments aren't - # recognized, but it solves some users' problems. - env = os.environ.get(env_var, '') - if env: - self.timid = ('--timid' in env) - MUST_BE_LIST = ["omit", "include", "debug", "plugins"] def from_args(self, **kwargs): -- cgit v1.2.1 From 066a693d77b0b950653cf5b577d308da594fa471 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 11 Oct 2014 08:06:17 -0400 Subject: Can change config after construction. --- coverage/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index ece68ba8..f262a043 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -266,3 +266,18 @@ class CoverageConfig(object): def get_plugin_options(self, plugin): """Get a dictionary of options for the plugin named `plugin`.""" return self.plugin_options.get(plugin, {}) + + # TODO: docs for this. + def __setitem__(self, names, value): + for option_spec in self.CONFIG_FILE_OPTIONS: + attr, where = option_spec[:2] + if where == names: + setattr(self, attr, value) + return + + # TODO: docs for this. + def __getitem__(self, names): + for option_spec in self.CONFIG_FILE_OPTIONS: + attr, where = option_spec[:2] + if where == names: + return getattr(self, attr) -- cgit v1.2.1 From 2e63e41be0774e51b7683457f31500d99c75c9f1 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 11 Oct 2014 22:12:28 -0400 Subject: Config tweaking applies to plugin options also --- coverage/config.py | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index f262a043..4d599ee7 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -2,6 +2,8 @@ import os, re, sys from coverage.backward import string_class, iitems +from coverage.misc import CoverageException + # In py3, # ConfigParser was renamed to the more-standard configparser try: @@ -268,16 +270,35 @@ class CoverageConfig(object): return self.plugin_options.get(plugin, {}) # TODO: docs for this. - def __setitem__(self, names, value): + def __setitem__(self, option_name, value): + # Check all the hard-coded options. for option_spec in self.CONFIG_FILE_OPTIONS: attr, where = option_spec[:2] - if where == names: + if where == option_name: setattr(self, attr, value) return + # See if it's a plugin option. + plugin_name, _, key = option_name.partition(":") + if key and plugin_name in self.plugins: + self.plugin_options.setdefault(plugin_name, {})[key] = value + return + + # If we get here, we didn't find the option. + raise CoverageException("No such option: %r" % option_name) + # TODO: docs for this. - def __getitem__(self, names): + def __getitem__(self, option_name): + # Check all the hard-coded options. for option_spec in self.CONFIG_FILE_OPTIONS: attr, where = option_spec[:2] - if where == names: + if where == option_name: return getattr(self, attr) + + # See if it's a plugin option. + plugin_name, _, key = option_name.partition(":") + if key and plugin_name in self.plugins: + return self.plugin_options.get(plugin_name, {}).get(key) + + # If we get here, we didn't find the option. + raise CoverageException("No such option: %r" % option_name) -- cgit v1.2.1