Skip to content

Commit 5baeae9

Browse files
Remove test dependency on unmaintained PyPI toml package
Use tomli-w for writing TOML instead. See also https://fedoraproject.org/wiki/Changes/DeprecatePythonToml.
1 parent cd379d7 commit 5baeae9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

requirements-test.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ build
22
coverage
33
pytest
44
pytest-rerunfailures
5-
toml
5+
# Some tests need to write TOML, but tomli and tomllib are read-only, and toml package is unmaintained
6+
tomli-w
67
wheel

tests/lib/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from secrets import token_hex
1111
from typing import Any, Callable
1212

13-
import toml
13+
import tomli_w
1414

1515
log = logging.getLogger(__name__)
1616
root = Path(__file__).parent.parent
@@ -217,7 +217,7 @@ def create_pyproject_toml(
217217
if config != NotImplemented:
218218
cfg["tool"] = {"setuptools-git-versioning": config}
219219

220-
return create_file(cwd, "pyproject.toml", toml.dumps(cfg), commit=commit, **kwargs)
220+
return create_file(cwd, "pyproject.toml", tomli_w.dumps(cfg), commit=commit, **kwargs)
221221

222222

223223
def create_setup_py(

tests/test_integration/test_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import textwrap
44

55
import pytest
6-
import toml
6+
import tomli_w
77

88
from tests.lib.util import (
99
create_file,
@@ -66,7 +66,7 @@ def test_config_not_used(repo):
6666
create_file(
6767
repo,
6868
"pyproject.toml",
69-
toml.dumps(cfg),
69+
tomli_w.dumps(cfg),
7070
)
7171

7272
assert get_version(repo, isolated=False) == "0.0.0"

0 commit comments

Comments
 (0)