Skip to content

Commit

Permalink
Support TOML v1.0.0 syntax in pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jul 9, 2021
1 parent 809cccb commit c57e408
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions coverage/tomlconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

# TOML support is an install-time extra option.
try:
import toml
import tomli
except ImportError: # pragma: not covered
toml = None
tomli = None


class TomlDecodeError(Exception):
Expand Down Expand Up @@ -44,11 +44,11 @@ def read(self, filenames):
toml_text = fp.read()
except OSError:
return []
if toml:
if tomli is not None:
toml_text = substitute_variables(toml_text, os.environ)
try:
self.data = toml.loads(toml_text)
except toml.TomlDecodeError as err:
self.data = tomli.loads(toml_text)
except tomli.TomlDecodeError as err:
raise TomlDecodeError(*err.args)
return [filename]
else:
Expand Down

0 comments on commit c57e408

Please sign in to comment.