diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-04-19 07:01:14 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-04-19 07:01:14 -0400 |
commit | 3d3dfc871f102f64737883ea78777a89b6126794 (patch) | |
tree | cd79a6f6d9dd883dca3a4cd76452c888be33340c /coverage/config.py | |
parent | ee02b2054674f583349c7c136d81690062e05e6f (diff) | |
download | python-coveragepy-git-3d3dfc871f102f64737883ea78777a89b6126794.tar.gz |
COVERAGE_RCFILE can specify the config file location. #650
Diffstat (limited to 'coverage/config.py')
-rw-r--r-- | coverage/config.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/config.py b/coverage/config.py index 260dafd4..285cb219 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -447,6 +447,12 @@ def config_files_to_try(config_file): config_file = True specified_file = (config_file is not True) if not specified_file: + # No file was specified. Check COVERAGE_RCFILE. + config_file = os.environ.get('COVERAGE_RCFILE') + if config_file: + specified_file = True + if not specified_file: + # Still no file specified. Default to .coveragerc config_file = ".coveragerc" files_to_try = [ (config_file, True, specified_file), @@ -483,7 +489,7 @@ def read_coverage_config(config_file, **kwargs): config_read = config.from_file(fname, our_file=our_file) if config_read: break - if our_file and specified_file: + if specified_file: raise CoverageException("Couldn't read '%s' as a config file" % fname) # 3) from environment variables: |