diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2021-07-26 14:39:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-26 14:39:11 +0100 |
commit | 054d277dd18a9fe38c1114237b8a809dd8c98f14 (patch) | |
tree | 981c7fe7a28d25a2bf5d076153411d164fd07e43 /src | |
parent | 712fe13015edf77f3204a4bed370340310e1ace0 (diff) | |
download | tox-git-054d277dd18a9fe38c1114237b8a809dd8c98f14.tar.gz |
Move from toml to tomli (#2118)
Diffstat (limited to 'src')
-rw-r--r-- | src/tox/config/source/legacy_toml.py | 5 | ||||
-rw-r--r-- | src/tox/util/pep517/frontend.py | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/tox/config/source/legacy_toml.py b/src/tox/config/source/legacy_toml.py index a100ff66..4935eaba 100644 --- a/src/tox/config/source/legacy_toml.py +++ b/src/tox/config/source/legacy_toml.py @@ -1,6 +1,6 @@ from pathlib import Path -import toml +import tomli from .ini import IniSource @@ -11,7 +11,8 @@ class LegacyToml(IniSource): def __init__(self, path: Path): if path.name != self.FILENAME or not path.exists(): raise ValueError - toml_content = toml.loads(path.read_text()) + with path.open() as file_handler: + toml_content = tomli.load(file_handler) try: content = toml_content["tool"]["tox"]["legacy_tox_ini"] except KeyError: diff --git a/src/tox/util/pep517/frontend.py b/src/tox/util/pep517/frontend.py index 7310b68c..e1c8f4bf 100644 --- a/src/tox/util/pep517/frontend.py +++ b/src/tox/util/pep517/frontend.py @@ -9,7 +9,7 @@ from time import sleep from typing import Any, Dict, Iterator, List, NamedTuple, NoReturn, Optional, Tuple, cast from zipfile import ZipFile -import toml +import tomli from packaging.requirements import Requirement _HERE = Path(__file__).parent @@ -106,7 +106,8 @@ class Frontend(ABC): ) -> Tuple[Path, Tuple[Path, ...], str, Optional[str], Tuple[Requirement, ...], bool]: py_project_toml = folder / "pyproject.toml" if py_project_toml.exists(): - py_project = toml.load(py_project_toml) + with py_project_toml.open() as file_handler: + py_project = tomli.load(file_handler) build_system = py_project.get("build-system", {}) if "backend-path" in build_system: backend_paths: Tuple[Path, ...] = tuple(folder / p for p in build_system["backend-path"]) |