diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-11 21:41:40 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-11 21:41:40 -0500 |
commit | bcfbd8d2fdc724fa3cff945d4d6d19a36a2d0312 (patch) | |
tree | 071c81392054e3fcd352333f105c09cd20ebf2f0 /coverage/control.py | |
parent | 67103f35b69d8f6d021608ab02fa0daab61b52c2 (diff) | |
download | python-coveragepy-git-bcfbd8d2fdc724fa3cff945d4d6d19a36a2d0312.tar.gz |
Treat config_file=".coveragerc" the same as config_file=True. #357
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/coverage/control.py b/coverage/control.py index 7532d291..65830ee7 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -78,10 +78,19 @@ class Coverage(object): If `branch` is true, then branch coverage will be measured in addition to the usual statement coverage. - `config_file` determines what config file to read. If it is a string, - it is the name of the config file to read. If it is True, then a - standard file is read (".coveragerc"). If it is False, then no file is - read. + `config_file` determines what configuration file to read: + + * If it is ".coveragerc", it is interpreted as if it were True, + for backward compatibility. + + * If it is a string, it is the name of the file to read. If the + file can't be read, it is an error. + + * If it is True, then a few standard files names are tried + (".coveragerc", "setup.cfg"). It is not an error for these files + to not be found. + + * If it is False, then no configuration file is read. `source` is a list of file paths or package names. Only code located in the trees indicated by the file paths or package names will be @@ -107,6 +116,10 @@ class Coverage(object): # 2: from the rcfile, .coveragerc or setup.cfg file: if config_file: did_read_rc = False + # Some API users were specifying ".coveragerc" to mean the same as + # True, so make it so. + if config_file == ".coveragerc": + config_file = True specified_file = (config_file is not True) if not specified_file: config_file = ".coveragerc" |