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 | c1f14311c417483b8d92c7d998f6ab0a71229f9d (patch) | |
tree | f63c24b09fd147e2b8a097acd1b74fce9087a1cd /coverage/config.py | |
parent | 752ff804305d84ca12dbfc07211d27c5026f1682 (diff) | |
download | python-coveragepy-c1f14311c417483b8d92c7d998f6ab0a71229f9d.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 260dafd..285cb21 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: |