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 b2893a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def better_set_verbosity(v):

extras_require={
# Enable pyproject.toml support.
'toml': ['toml'],
'toml': ['tomli'],
},

# We need to get HTML assets from our htmlfiles directory.
Expand Down

0 comments on commit b2893a8

Please sign in to comment.