From bcfbd8d2fdc724fa3cff945d4d6d19a36a2d0312 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 11 Feb 2015 21:41:40 -0500 Subject: Treat config_file=".coveragerc" the same as config_file=True. #357 --- coverage/control.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'coverage/control.py') 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" -- cgit v1.2.1