Skip to content

Commit cb781c6

Browse files
fix: use tomllib/tomli compat import for Python 3.10 support
1 parent cd39887 commit cb781c6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_converter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,10 @@ def test_version_in_init_matches_pyproject(self):
470470
"""pyproject.toml version must match __init__.__version__."""
471471
from pathlib import Path
472472

473-
import tomllib
473+
try:
474+
import tomllib
475+
except ImportError:
476+
import tomli as tomllib # Python < 3.11 backport
474477

475478
from json2sql import __version__
476479
pyproject = Path(__file__).resolve().parent.parent / "pyproject.toml"
@@ -479,4 +482,4 @@ def test_version_in_init_matches_pyproject(self):
479482
assert data["project"]["version"] == __version__, (
480483
f"pyproject.toml version ({data['project']['version']}) != "
481484
f"__init__.__version__ ({__version__})"
482-
)
485+
)

0 commit comments

Comments
 (0)