Skip to content

Commit

Permalink
Update deps, add python 3.11 (#311)
Browse files Browse the repository at this point in the history
* Update deps, add python 3.11

* Try importing the python 3.11 toml lib
  • Loading branch information
Bachmann1234 authored Jan 19, 2023
1 parent 216e3a1 commit 7ae18d3
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
Expand Down
14 changes: 11 additions & 3 deletions diff_cover/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
import enum

try:
import tomli
import tomli as toml

_HAS_TOML = True
except ImportError: # pragma: no cover
_HAS_TOML = False

if not _HAS_TOML:
try:
import tomllib as toml

_HAS_TOML = True
except ImportError: # pragma: no cover
pass


class Tool(enum.Enum):
DIFF_COVER = enum.auto()
Expand Down Expand Up @@ -38,10 +46,10 @@ def parse(self):
return None

if not _HAS_TOML:
raise ParserError("tomli is not installed")
raise ParserError("No Toml lib installed")

with open(self._file_name, "rb") as file_handle:
config = tomli.load(file_handle)
config = toml.load(file_handle)

config = config.get("tool", {}).get(self._section, {})
if not config:
Expand Down
Loading

0 comments on commit 7ae18d3

Please sign in to comment.