summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-12-04 07:34:32 -0500
committerNed Batchelder <ned@nedbatchelder.com>2019-12-04 07:34:32 -0500
commita7da1fe548d261451f6ceabd2bde751b4f6c14ca (patch)
tree3b9731234b477b99332848deae005fb46b1c6f67
parentb75575fd2cf3036d00624abbfc7d94f4f0c4aba8 (diff)
downloadpython-coveragepy-git-nedbat/configfile-simplification.tar.gz
Remove special handling of config_file=".coveragerc". #788nedbat/configfile-simplification
-rw-r--r--coverage/config.py4
-rw-r--r--coverage/control.py7
-rw-r--r--tests/test_config.py19
3 files changed, 2 insertions, 28 deletions
diff --git a/coverage/config.py b/coverage/config.py
index 6372f4c0..f20ef90d 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -467,10 +467,6 @@ def config_files_to_try(config_file):
(filename, is_our_file, was_file_specified)
"""
- # 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:
# No file was specified. Check COVERAGE_RCFILE.
diff --git a/coverage/control.py b/coverage/control.py
index 53942242..d9272fc6 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -126,15 +126,12 @@ class Coverage(object):
`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", "tox.ini"). It is not an error for
- these files to not be found.
+ (".coveragerc", "setup.cfg", "tox.ini", "pyproject.toml").
+ It is not an error for these files to not be found.
* If it is False, then no configuration file is read.
diff --git a/tests/test_config.py b/tests/test_config.py
index fe9e001e..1b9a4137 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -575,19 +575,6 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
def test_config_file_settings_in_toxini(self):
self.check_config_file_settings_in_other_file("tox.ini", self.TOX_INI)
- def check_other_config_if_coveragerc_specified(self, fname, contents):
- """Check that config `fname` is read if .coveragerc is missing, but specified."""
- nested = self.LOTSA_SETTINGS.format(section="coverage:")
- self.make_file(fname, nested + "\n" + contents)
- cov = coverage.Coverage(config_file=".coveragerc")
- self.assert_config_settings_are_correct(cov)
-
- def test_config_file_settings_in_setupcfg_if_coveragerc_specified(self):
- self.check_other_config_if_coveragerc_specified("setup.cfg", self.SETUP_CFG)
-
- def test_config_file_settings_in_tox_if_coveragerc_specified(self):
- self.check_other_config_if_coveragerc_specified("tox.ini", self.TOX_INI)
-
def check_other_not_read_if_coveragerc(self, fname):
"""Check config `fname` is not read if .coveragerc exists."""
self.make_file(".coveragerc", """\
@@ -671,12 +658,6 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
with self.assertRaisesRegex(CoverageException, msg):
coverage.Coverage(config_file=bad_file)
- def test_nocoveragerc_file_when_specified(self):
- cov = coverage.Coverage(config_file=".coveragerc")
- self.assertFalse(cov.config.timid)
- self.assertFalse(cov.config.branch)
- self.assertEqual(cov.config.data_file, ".coverage")
-
def test_no_toml_installed_no_toml(self):
# Can't read a toml file that doesn't exist.
with coverage.optional.without('toml'):