diff --git a/pyaptly/conftest.py b/pyaptly/conftest.py index 6d8157a..6eda42a 100644 --- a/pyaptly/conftest.py +++ b/pyaptly/conftest.py @@ -8,8 +8,6 @@ import freezegun import pytest -import tomli -import yaml from pyaptly import main, state_reader, util @@ -114,16 +112,7 @@ def test_mirror_create(environment, config, caplog): ... ``` """ - config_file = test_base / request.param - with config_file.open("rb") as f: - config = tomli.load(f) - # TODO: remove yaml conversion - try: - with tempfile.NamedTemporaryFile(mode="w", encoding="UTF-8", delete=False) as f: - yaml.dump(config, f) - yield f.name - finally: - Path(f.name).unlink() + yield str(test_base / request.param) @pytest.fixture() diff --git a/pyaptly/main.py b/pyaptly/main.py index 16dae12..f1319cf 100755 --- a/pyaptly/main.py +++ b/pyaptly/main.py @@ -1,10 +1,9 @@ """Aptly mirror/snapshot managment automation.""" import argparse -import codecs import logging import sys -import yaml +import tomli from . import command, mirror, publish, repo, snapshot, state_reader @@ -84,8 +83,8 @@ def main(argv=None): _logging_setup = True # noqa lg.debug("Args: %s", vars(args)) - with codecs.open(args.config, "r", encoding="UTF-8") as cfgfile: - cfg = yaml.load(cfgfile, Loader=yaml.FullLoader) + with open(args.config, "rb") as f: + cfg = tomli.load(f) state_reader.state.read() # run function for selected subparser diff --git a/pyaptly/tests/test_dateround.py b/pyaptly/tests/test_dateround.py index 8a61935..8b60eaa 100644 --- a/pyaptly/tests/test_dateround.py +++ b/pyaptly/tests/test_dateround.py @@ -4,7 +4,7 @@ import os.path import pytest -import yaml +import tomli from hypothesis import given from hypothesis.strategies import datetimes, integers, times @@ -173,8 +173,8 @@ def test_daily_examples(): @pytest.mark.parametrize("config", ["publish-previous.toml"], indirect=True) def test_snapshot_spec_to_name(config, test_path, freeze): """Test the complete functionality (snapshot_spec_to_name).""" - with (test_path / config).open("r") as f: - tyml = yaml.load(f, Loader=yaml.FullLoader) + with open(config, "rb") as f: + tyml = tomli.load(f) snaps = tyml["snapshot"]["superfake-%T"]["merge"] rounded1 = snapshot.snapshot_spec_to_name(tyml, snaps[0])