aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2023-01-14 23:59:29 -0800
committerArthur Zamarin <arthurzam@gentoo.org>2023-02-02 21:59:11 +0200
commit2c03223768fb522a85b410db382d3e9f53575666 (patch)
tree1cb9eb666a86c9e447ade10e6b069f712f4d1e92 /tests/config
parentrefactor(config): adding typing to config hints along with immutability. (diff)
downloadpkgcore-2c03223768fb522a85b410db382d3e9f53575666.tar.gz
pkgcore-2c03223768fb522a85b410db382d3e9f53575666.tar.bz2
pkgcore-2c03223768fb522a85b410db382d3e9f53575666.zip
refactor(config): Remove ConfigHint/configurable positional arg support
This never made much sense in light of how args were handled, and it complicates the heck out of typing, thus require invokers to be explicit. Signed-off-by: Brian Harring <ferringb@gmail.com> Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/test_basics.py2
-rw-r--r--tests/config/test_central.py22
2 files changed, 14 insertions, 10 deletions
diff --git a/tests/config/test_basics.py b/tests/config/test_basics.py
index 929c907c2..7dfc88dbf 100644
--- a/tests/config/test_basics.py
+++ b/tests/config/test_basics.py
@@ -11,7 +11,7 @@ def passthrough(*args, **kwargs):
def test_invalid_config_types():
for var in ("class", "inherit"):
- @configurable({var: "str"})
+ @configurable(types={var: "str"})
def testtype():
pass
diff --git a/tests/config/test_central.py b/tests/config/test_central.py
index f3fc1c702..5ffb8072b 100644
--- a/tests/config/test_central.py
+++ b/tests/config/test_central.py
@@ -1,8 +1,8 @@
import pytest
+from snakeoil.errors import walk_exception_chain
from pkgcore.config import basics, central, errors
from pkgcore.config.hint import configurable
-from snakeoil.errors import walk_exception_chain
# A bunch of functions used from various tests below.
@@ -10,7 +10,7 @@ def repo(cache):
return cache
-@configurable({"content": "ref:drawer", "contents": "refs:drawer"})
+@configurable(types={"content": "ref:drawer", "contents": "refs:drawer"})
def drawer(content=None, contents=None):
return content, contents
@@ -391,7 +391,7 @@ def test_reinstantiate_after_raise():
# reprocess already processed section_ref args.
spork = object()
- @configurable({"thing": "ref:spork"})
+ @configurable(types={"thing": "ref:spork"})
def myrepo(thing):
assert thing is spork
raise errors.ComplexInstantiationError("I suck")
@@ -585,11 +585,11 @@ def test_alias():
def test_typecheck():
- @configurable({"myrepo": "ref:repo"}, typename="repo")
+ @configurable(types={"myrepo": "ref:repo"}, typename="repo")
def reporef(myrepo=None):
return myrepo
- @configurable({"myrepo": "refs:repo"}, typename="repo")
+ @configurable(types={"myrepo": "refs:repo"}, typename="repo")
def reporefs(myrepo=None):
return myrepo
@@ -804,11 +804,15 @@ def test_autoload_wrong_type():
def test_lazy_refs():
- @configurable({"myrepo": "lazy_ref:repo", "thing": "lazy_ref"}, typename="repo")
+ @configurable(
+ types={"myrepo": "lazy_ref:repo", "thing": "lazy_ref"}, typename="repo"
+ )
def reporef(myrepo=None, thing=None):
return myrepo, thing
- @configurable({"myrepo": "lazy_refs:repo", "thing": "lazy_refs"}, typename="repo")
+ @configurable(
+ types={"myrepo": "lazy_refs:repo", "thing": "lazy_refs"}, typename="repo"
+ )
def reporefs(myrepo=None, thing=None):
return myrepo, thing
@@ -981,7 +985,7 @@ def test_prepend_inherit():
def test_list_prepend():
- @configurable({"seq": "list"})
+ @configurable(types={"seq": "list"})
def seq(seq):
return seq
@@ -1018,7 +1022,7 @@ def test_list_prepend():
def test_str_prepend():
- @configurable({"string": "str"})
+ @configurable(types={"string": "str"})
def sect(string):
return string