Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ install_requires =
virtualenv!=20.0.0,!=20.0.1,!=20.0.2,!=20.0.3,!=20.0.4,!=20.0.5,!=20.0.6,!=20.0.7,>=16.0.0
colorama>=0.4.1 ;platform_system=="Windows"
importlib-metadata>=0.12;python_version<"3.8"
tomli;python_version<"3.11"
toml;python_version<"3.11"
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*

[options.packages.find]
Expand Down
12 changes: 8 additions & 4 deletions src/tox/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
import six

if sys.version_info >= (3, 11):
import tomllib
import tomllib as toml_loader
toml_mode = "rb"
toml_encoding = None
else:
import tomli as tomllib
import toml as toml_loader
toml_mode = "r"
toml_encoding = "UTF-8"

from packaging import requirements
from packaging.utils import canonicalize_name
Expand Down Expand Up @@ -309,8 +313,8 @@ def parseconfig(args, plugins=()):


def get_py_project_toml(path):
with io.open(str(path), mode="rb") as file_handler:
config_data = tomllib.load(file_handler)
with io.open(str(path), mode=toml_mode, encoding=toml_encoding) as file_handler:
config_data = toml_loader.load(file_handler)
return config_data


Expand Down