From 4e3fc6a6254ea99e96e9f05978272297841cf962 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 12 Dec 2023 17:54:31 +0100 Subject: [PATCH] osbuild: pytoml is deprecated, replace with toml Pytoml is no longer being maintained: https://github.com/avakar/pytoml The author suggest switching to toml. We already use the ``` try: import toml except ModuleNotFoundError: import pytoml as toml ``` pattern in stages/org.osbuild.containers.storage.conf so use it in the tests too to prefer "toml" instead of pytoml. --- stages/test/test_containers_storage_conf.py | 10 +++++++--- tox.ini | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/stages/test/test_containers_storage_conf.py b/stages/test/test_containers_storage_conf.py index 09e6e415..84184ef4 100644 --- a/stages/test/test_containers_storage_conf.py +++ b/stages/test/test_containers_storage_conf.py @@ -3,7 +3,11 @@ import os.path import pytest -import pytoml + +try: + import toml +except ModuleNotFoundError: + import pytoml as toml import osbuild.meta from osbuild.testutil import assert_dict_has @@ -45,8 +49,8 @@ def test_containers_storage_conf_integration(tmp_path, test_filename, test_stora assert os.path.exists(confpath) conf = None - with open(confpath, 'rb') as f: - conf = pytoml.load(f) + with open(confpath, 'r', encoding="utf-8") as f: + conf = toml.load(f) assert conf is not None diff --git a/tox.ini b/tox.ini index 475577b1..756c9d75 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ deps = mako iniparse pyyaml - pytoml + toml pykickstart # required by pykickstart but not pulled in automatically :/ requests