summaryrefslogtreecommitdiff
path: root/coverage/tomlconfig.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-01-18 18:08:56 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-01-18 18:23:27 -0500
commita09b1714c26cde1542044f44295600679d4368fc (patch)
treeb0330905216c5a80f6c5c675494a95a00b3997a2 /coverage/tomlconfig.py
parent94239ad30e56f8f4bf01dcaf8700cdecca86e7f1 (diff)
downloadpython-coveragepy-git-a09b1714c26cde1542044f44295600679d4368fc.tar.gz
Simplify the testing of the toml extra, fixing #1084
Diffstat (limited to 'coverage/tomlconfig.py')
-rw-r--r--coverage/tomlconfig.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/coverage/tomlconfig.py b/coverage/tomlconfig.py
index 25542f99..3ad58157 100644
--- a/coverage/tomlconfig.py
+++ b/coverage/tomlconfig.py
@@ -11,6 +11,12 @@ from coverage import env
from coverage.backward import configparser, path_types
from coverage.misc import CoverageException, substitute_variables
+# TOML support is an install-time extra option.
+try:
+ import toml
+except ImportError: # pragma: not covered
+ toml = None
+
class TomlDecodeError(Exception):
"""An exception class that exists even when toml isn't installed."""
@@ -29,8 +35,6 @@ class TomlConfigParser:
self.data = None
def read(self, filenames):
- from coverage.optional import toml
-
# RawConfigParser takes a filename or list of filenames, but we only
# ever call this with a single filename.
assert isinstance(filenames, path_types)