aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-09-24 21:46:20 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-09-24 21:46:20 +0300
commit1c87f0f8cbf85b6bde4451f64a5c4fa68a48fb6d (patch)
tree1903a00f16e067912c44ea95cef7865f6d7e6375 /tests
parentstart work on v0.12.15 (diff)
downloadpkgcore-1c87f0f8cbf85b6bde4451f64a5c4fa68a48fb6d.tar.gz
pkgcore-1c87f0f8cbf85b6bde4451f64a5c4fa68a48fb6d.tar.bz2
pkgcore-1c87f0f8cbf85b6bde4451f64a5c4fa68a48fb6d.zip
use less deprecated cruft of snakeoil
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/config/test_init.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/tests/config/test_init.py b/tests/config/test_init.py
index 1c1a1e80..1e2cc9cf 100644
--- a/tests/config/test_init.py
+++ b/tests/config/test_init.py
@@ -4,7 +4,6 @@ import pytest
from pkgcore.config import basics, load_config
from pkgcore.config.hint import configurable
-from snakeoil.test.mixins import mk_named_tempfile
@configurable(typename='foo')
@@ -15,47 +14,43 @@ def passthrough(*args, **kwargs):
class TestConfigLoading:
@pytest.fixture
- def user_config(self):
- user_config = mk_named_tempfile()
- user_config.write(
+ def user_config(self, tmp_path):
+ user_config = tmp_path / 'user.conf'
+ user_config.write_text(
'[foo]\n'
'class = tests.config.test_init.passthrough\n'
)
- user_config.flush()
- yield user_config
- user_config.close()
+ return str(user_config)
@pytest.fixture
- def system_config(self):
- system_config = mk_named_tempfile()
- system_config.write(
+ def system_config(self, tmp_path):
+ system_config = tmp_path / 'system.conf'
+ system_config.write_text(
'[foo]\n'
'class = also invalid\n'
)
- system_config.flush()
- yield system_config
- system_config.close()
+ return str(system_config)
def test_load_config(self, user_config):
- manager = load_config(user_conf_file=user_config.name)
+ manager = load_config(user_conf_file=user_config)
assert manager.foo['foo'] == ((), {})
def test_user_config_override_system(self, user_config, system_config):
manager = load_config(
- user_conf_file=user_config.name,
- system_conf_file=system_config.name)
+ user_conf_file=user_config,
+ system_conf_file=system_config)
assert manager.foo['foo'] == ((), {})
def test_prepends(self, user_config):
manager = load_config(
- user_conf_file=user_config.name,
+ user_conf_file=user_config,
prepend_sources=[{'myfoo': basics.HardCodedConfigSection({
'inherit': ['foo']})}])
assert manager.foo['myfoo'] == ((), {})
def test_disabling_loading(self, user_config):
manager = load_config(
- user_conf_file=user_config.name,
+ user_conf_file=user_config,
skip_config_files=True)
with pytest.raises(KeyError):
manager.foo['foo']