diff --git a/swh/core/api/__init__.py b/swh/core/api/__init__.py --- a/swh/core/api/__init__.py +++ b/swh/core/api/__init__.py @@ -17,9 +17,9 @@ encode_data_client as encode_data, msgpack_dumps, msgpack_loads, SWHJSONDecoder) -from .negotiate import (Formatter as FormatterBase, - Negotiator as NegotiatorBase, - negotiate as _negotiate) +from .negotiation import (Formatter as FormatterBase, + Negotiator as NegotiatorBase, + negotiate as _negotiate) logger = logging.getLogger(__name__) diff --git a/swh/core/api/negotiate.py b/swh/core/api/negotiation.py rename from swh/core/api/negotiate.py rename to swh/core/api/negotiation.py diff --git a/swh/core/config.py b/swh/core/config.py --- a/swh/core/config.py +++ b/swh/core/config.py @@ -193,39 +193,40 @@ - dict + val -> TypeError - val + val -> val (other) - so merging + for instance: - { - 'key1': { - 'skey1': value1, - 'skey2': {'sskey1': value2}, - }, - 'key2': value3, - } + >>> d1 = { + ... 'key1': { + ... 'skey1': 'value1', + ... 'skey2': {'sskey1': 'value2'}, + ... }, + ... 'key2': 'value3', + ... } with - { - 'key1': { - 'skey1': value4, - 'skey2': {'sskey2': value5}, - }, - 'key3': value6, - } + >>> d2 = { + ... 'key1': { + ... 'skey1': 'value4', + ... 'skey2': {'sskey2': 'value5'}, + ... }, + ... 'key3': 'value6', + ... } will give: - { - 'key1': { - 'skey1': value4, # <-- note this - 'skey2': { - 'sskey1': value2, - 'sskey2': value5, - }, - }, - 'key2': value3, - 'key3': value6, - } + >>> d3 = { + ... 'key1': { + ... 'skey1': 'value4', # <-- note this + ... 'skey2': { + ... 'sskey1': 'value2', + ... 'sskey2': 'value5', + ... }, + ... }, + ... 'key2': 'value3', + ... 'key3': 'value6', + ... } + >>> assert merge_configs(d1, d2) == d3 Note that no type checking is done for anything but dicts. """ diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ pytest-cov pifpaf commands = - pifpaf run postgresql -- pytest --hypothesis-profile=fast --cov=swh --cov-branch {posargs} + pifpaf run postgresql -- pytest --doctest-modules --hypothesis-profile=fast --cov=swh --cov-branch {posargs} [testenv:py3-slow] deps = @@ -15,7 +15,7 @@ pytest-cov pifpaf commands = - pifpaf run postgresql -- pytest --hypothesis-profile=slow --cov=swh --cov-branch {posargs} + pifpaf run postgresql -- pytest --doctest-modules --hypothesis-profile=slow --cov=swh --cov-branch {posargs} [testenv:flake8]