pcah/python-clean-architecture

PyPy3: fix errors

lhaze opened this issue · 0 comments

lhaze commented

After providing PyPy3 support, some PyPy-specific errors appeared.

~/workspace/pca$ docker-compose run test_pypy3
WARNING: Found orphan containers (pca_dev_py37) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating pca_test_pypy3_run ... done
Skipping virtualenv creation, as specified in config file.
==================================================================================================== test session starts ====================================================================================================
platform linux -- Python 3.7.10[pypy-7.3.5-final], pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /workspace, configfile: pyproject.toml
plugins: pyfakefs-4.3.2, cov-2.10.1, mock-3.3.1
collected 423 items                                                                                                                                                                                                         

devops/utils/tests/test_os.py ..s                                                                                                                                                                                     [  0%]
devops/utils/tests/test_version.py ..............................................                                                                                                                                     [ 11%]
pca/application/tests/test_interactor.py .............                                                                                                                                                                [ 14%]
pca/data/dao/tests/test_in_memory.py ..............................                                                                                                                                                   [ 21%]
pca/data/tests/test_descriptors.py ...........                                                                                                                                                                        [ 24%]
pca/data/tests/test_observable.py ...........                                                                                                                                                                         [ 26%]
pca/data/tests/test_predicate.py .........................                                                                                                                                                            [ 32%]
pca/data/tests/test_validation.py ....                                                                                                                                                                                [ 33%]
pca/domain/tests/test_entity.py ...........                                                                                                                                                                           [ 36%]
pca/domain/tests/test_policy.py ..                                                                                                                                                                                    [ 36%]
pca/domain/tests/test_repository.py ....F....F....FF                                                                                                                                                                  [ 40%]
pca/integration/tests/test_tinydb.py ssssssssssssssssssssssssssssssssss                                                                                                                                               [ 48%]
pca/utils/dependency_injection/tests/test_container.py .FFFF.......FFF...F                                                                                                                                            [ 53%]
pca/utils/dependency_injection/tests/test_decorators.py ...FF.                                                                                                                                                        [ 54%]
pca/utils/dependency_injection/tests/test_descriptors.py ..FF..                                                                                                                                                       [ 56%]
pca/utils/serialization/tests/test_ini.py .                                                                                                                                                                           [ 56%]
pca/utils/serialization/tests/test_json.py .                                                                                                                                                                          [ 56%]
pca/utils/serialization/tests/test_loaders.py .........                                                                                                                                                               [ 58%]
pca/utils/serialization/tests/test_yaml.py .......                                                                                                                                                                    [ 60%]
pca/utils/tests/test_errors.py ..................                                                                                                                                                                     [ 64%]
pca/utils/tests/test_functools.py ............                                                                                                                                                                        [ 67%]
pca/utils/tests/test_operators.py ....................                                                                                                                                                                [ 72%]
pca/utils/tests/collections/test_bunch.py .......                                                                                                                                                                     [ 73%]
pca/utils/tests/collections/test_freeze.py .........................................                                                                                                                                  [ 83%]
pca/utils/tests/collections/test_frozendict.py .........                                                                                                                                                              [ 85%]
pca/utils/tests/collections/test_get_duplicates.py ........                                                                                                                                                           [ 87%]
pca/utils/tests/collections/test_iterate_over_values.py .                                                                                                                                                             [ 87%]
pca/utils/tests/collections/test_ordered_set.py ...........                                                                                                                                                           [ 90%]
pca/utils/tests/collections/test_sget.py ..................                                                                                                                                                           [ 94%]
pca/utils/tests/imports/__init__.py ...........                                                                                                                                                                       [ 97%]
pca/utils/tests/imports/test_get_dotted_path.py .                                                                                                                                                                     [ 97%]
pca/utils/tests/imports/test_import_dotted_path.py .......                                                                                                                                                            [ 99%]
pca/utils/tests/inspect/test_get_subclasses.py ....                                                                                                                                                                   [100%]

========================================================================================================= FAILURES ==========================================================================================================
_________________________________________________________________________________________ TestConstruction.test_dao_injection_error _________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/domain/tests/test_repository.py:100: in test_dao_injection_error
    assert repo.dao
pca/data/descriptors.py:51: in __get__
    val = self.wrapped(instance)
pca/domain/repository.py:84: in dao
    return self.container.find_by_interface(interface=IDao, qualifier=self.entity)
pca/utils/dependency_injection/container.py:193: in find_by_interface
    return self._find(DIContext(interface=interface, qualifier=qualifier))
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
__________________________________________________________________________________________________ TestApi.test_find_error __________________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/domain/tests/test_repository.py:143: in test_find_error
    assert repo.find(id_)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
____________________________________________________________________________________________ TestApi.test_remove_error_not_added ____________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/domain/tests/test_repository.py:172: in test_remove_error_not_added
    repo.remove(entity)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
____________________________________________________________________________________________ TestApi.test_remove_error_wrong_id _____________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/domain/tests/test_repository.py:181: in test_remove_error_wrong_id
    repo.remove(entity)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_____________________________________________________________________________________ TestContainer.test_container_interface_duplicates _____________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:43: in test_container_interface_duplicates
    container.register_by_interface(interface, GravelFrame)
pca/utils/dependency_injection/container.py:170: in register_by_interface
    self._register(context=context, constructor=constructor, kwargs=kwargs, scope=scope)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_____________________________________________________________________________________ TestContainer.test_container_interface_not_found ______________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:54: in test_container_interface_not_found
    container.find_by_interface(interface, qualifier)
pca/utils/dependency_injection/container.py:193: in find_by_interface
    return self._find(DIContext(interface=interface, qualifier=qualifier))
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_______________________________________________________________________________________ TestContainer.test_container_name_duplicates ________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:65: in test_container_name_duplicates
    container.register_by_name(name=name, constructor=GravelFrame)
pca/utils/dependency_injection/container.py:142: in register_by_name
    self._register(context=context, constructor=constructor, kwargs=kwargs, scope=scope)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
________________________________________________________________________________________ TestContainer.test_container_name_not_found ________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:76: in test_container_name_not_found
    container.find_by_name(name, qualifier)
pca/utils/dependency_injection/container.py:188: in find_by_name
    return self._find(DIContext(name=name, qualifier=qualifier))
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_____________________________________________________________________________________________ TestContext.test_empty_definition _____________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:166: in test_empty_definition
    DIContext().get(container)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
___________________________________________________________________________________________ TestContext.test_ambiguous_definition ___________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:171: in test_ambiguous_definition
    DIContext(name="name", interface=str).get(container)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_____________________________________________________________________________________ TestContext.test_contradictory_qualifier_defined ______________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:178: in test_contradictory_qualifier_defined
    DIContext(name="name", qualifier="qualifier", get_qualifier=get_qualifier)
<string>:7: in __init__
    ???
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
___________________________________________________________________________________ TestContext.test_indeterminate_context_being_resolved ___________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_container.py:216: in test_indeterminate_context_being_resolved
    context.get(container)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
___________________________________________________________________________________ TestInjectDecorator.test_inject_no_name_or_interface ____________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_decorators.py:81: in test_inject_no_name_or_interface
    instance.construct_without_identifier()
pca/utils/dependency_injection/decorators.py:68: in wrapper
    kwargs[name_] = dependency_declaration.get(container)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
_______________________________________________________________________________________ TestInjectDecorator.test_inject_no_container ________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_decorators.py:87: in test_inject_no_container
    assert instance.construct_successfully()
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
______________________________________________________________________________________ TestInjectDescriptor.test_no_name_no_interface _______________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_descriptors.py:58: in test_no_name_no_interface
    assert instance.wheel
pca/utils/dependency_injection/descriptors.py:70: in __get__
    return context.get(container=container)
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
__________________________________________________________________________________________ TestInjectDescriptor.test_no_container ___________________________________________________________________________________________
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.interfaces.dao.IDao'>, qualifier=<class 'test_repository.Bike'>, get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name=None, interface=<class 'pca.utils.dependency_injection.tests.components.FrameInterface'>, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/container.py:197: in _find
    resolution = self._constructor_registry[context]
E   KeyError: DIContext(name='frame', interface=None, qualifier='qualifier', get_qualifier=None)

During handling of the above exception, another exception occurred:
pca/utils/dependency_injection/tests/test_descriptors.py:73: in test_no_container
    assert A().descriptor
pca/utils/errors.py:73: in __setattr__
    "The instances of this class should be considered immutable."
E   AttributeError: The instances of this class should be considered immutable.
================================================================================================== short test summary info ==================================================================================================
FAILED pca/domain/tests/test_repository.py::TestConstruction::test_dao_injection_error - AttributeError: The instances of this class should be considered immutable.
FAILED pca/domain/tests/test_repository.py::TestApi::test_find_error - AttributeError: The instances of this class should be considered immutable.
FAILED pca/domain/tests/test_repository.py::TestApi::test_remove_error_not_added - AttributeError: The instances of this class should be considered immutable.
FAILED pca/domain/tests/test_repository.py::TestApi::test_remove_error_wrong_id - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContainer::test_container_interface_duplicates - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContainer::test_container_interface_not_found - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContainer::test_container_name_duplicates - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContainer::test_container_name_not_found - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContext::test_empty_definition - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContext::test_ambiguous_definition - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContext::test_contradictory_qualifier_defined - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_container.py::TestContext::test_indeterminate_context_being_resolved - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_decorators.py::TestInjectDecorator::test_inject_no_name_or_interface - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_decorators.py::TestInjectDecorator::test_inject_no_container - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_descriptors.py::TestInjectDescriptor::test_no_name_no_interface - AttributeError: The instances of this class should be considered immutable.
FAILED pca/utils/dependency_injection/tests/test_descriptors.py::TestInjectDescriptor::test_no_container - AttributeError: The instances of this class should be considered immutable.
======================================================================================== 16 failed, 372 passed, 35 skipped in 4.52s =========================================================================================