From 25f64ac49a7201b6f285a29c1d54672789db44e9 Mon Sep 17 00:00:00 2001 From: MarcoFavorito Date: Sun, 4 Sep 2022 23:06:13 +0200 Subject: [PATCH 01/13] Revert "fix: attach modules to their parent when loading aea package modules in sys.modules" This reverts commit 5243e1eecda1ca10ed7608bee895f89633fa7da4. --- aea/components/base.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/aea/components/base.py b/aea/components/base.py index 4f858abb8e..db51307a03 100644 --- a/aea/components/base.py +++ b/aea/components/base.py @@ -339,22 +339,15 @@ def perform_load_aea_package( prefix_root_module = types.ModuleType(prefix_root) prefix_root_module.__path__ = None # type: ignore - actual_prefix_root_module = sys.modules.get(prefix_root, prefix_root_module) - sys.modules[prefix_root] = actual_prefix_root_module + sys.modules[prefix_root] = sys.modules.get(prefix_root, prefix_root_module) author_module = types.ModuleType(prefix_author) author_module.__path__ = None # type: ignore - actual_prefix_author_module = sys.modules.get(prefix_author, author_module) - sys.modules[prefix_author] = actual_prefix_author_module - setattr(actual_prefix_root_module, author, actual_prefix_author_module) + sys.modules[prefix_author] = sys.modules.get(prefix_author, author_module) prefix_pkg_type_module = types.ModuleType(prefix_pkg_type) prefix_pkg_type_module.__path__ = None # type: ignore - actual_prefix_pkg_type_module = sys.modules.get( + sys.modules[prefix_pkg_type] = sys.modules.get( prefix_pkg_type, prefix_pkg_type_module ) - sys.modules[prefix_pkg_type] = actual_prefix_pkg_type_module - setattr( - actual_prefix_author_module, package_type_plural, actual_prefix_pkg_type_module - ) prefix_pkg = prefix_pkg_type + f".{package_name}" @@ -373,10 +366,3 @@ def perform_load_aea_package( sys.modules[import_path] = module _default_logger.debug(f"loading {import_path}: {module}") spec.loader.exec_module(module) # type: ignore - - # attach child module to parent module - import_path_parts = import_path.split(".") - parent_module_import_path = ".".join(import_path_parts[:-1]) - module_name = import_path_parts[-1] - parent_module = sys.modules[parent_module_import_path] - setattr(parent_module, module_name, module) From 9815229e3cbde0aeb041ba53a0797fe48876e851 Mon Sep 17 00:00:00 2001 From: Viraj Patel Date: Mon, 5 Sep 2022 06:33:52 +0000 Subject: [PATCH 02/13] test: fix module import on tac test --- packages/fetchai/protocols/tac/protocol.yaml | 2 +- packages/fetchai/protocols/tac/tests/test_tac.py | 4 ++-- packages/hashes.csv | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/fetchai/protocols/tac/protocol.yaml b/packages/fetchai/protocols/tac/protocol.yaml index 8c01469cf6..4660280773 100644 --- a/packages/fetchai/protocols/tac/protocol.yaml +++ b/packages/fetchai/protocols/tac/protocol.yaml @@ -16,7 +16,7 @@ fingerprint: serialization.py: bafybeifv24cywhafg5db6mmqxc3fz3jmt7bjg4jsaioeivqkvv2ra7rimq tac.proto: bafybeicqiktmsp2ud7zbddsovubo4cd6jtgqwdpm3dwegvf7xhlc3culmq tac_pb2.py: bafybeiduhujxst63ocjj4nh2pddbxqyqbpibmcvrx2xkqubo3dj247gqoa - tests/test_tac.py: bafybeiggwid7zlqwo53aefsdnddyqvdcia7ndtcuapqpxtssvbor7fnou4 + tests/test_tac.py: bafybeia2qaose7ch77mpm6yfzflpmpyj5qmdjf7nkrwlojjvfrkeodaxmq fingerprint_ignore_patterns: [] dependencies: protobuf: {} diff --git a/packages/fetchai/protocols/tac/tests/test_tac.py b/packages/fetchai/protocols/tac/tests/test_tac.py index 97fec595e0..e02fefb31b 100644 --- a/packages/fetchai/protocols/tac/tests/test_tac.py +++ b/packages/fetchai/protocols/tac/tests/test_tac.py @@ -32,7 +32,7 @@ from aea.protocols.dialogue.base import Dialogue as BaseDialogue from aea.protocols.dialogue.base import DialogueLabel -import packages +from packages.fetchai.protocols.tac import message from packages.fetchai.protocols.tac.dialogues import TacDialogue, TacDialogues from packages.fetchai.protocols.tac.message import TacMessage from packages.fetchai.protocols.tac.message import _default_logger as tac_message_logger @@ -409,7 +409,7 @@ def test_decoding_unknown_performative(): @mock.patch.object( - packages.fetchai.protocols.tac.message, + message, "enforce", side_effect=AEAEnforceError("some error"), ) diff --git a/packages/hashes.csv b/packages/hashes.csv index bef3bfe203..d5afa0bdda 100644 --- a/packages/hashes.csv +++ b/packages/hashes.csv @@ -16,7 +16,7 @@ fetchai/protocols/http,bafybeig7ilrz5b5a62kweohjoexdpdqmlw3zytwoyrlnqmpomgttf7f3 fetchai/protocols/ledger_api,bafybeiftily2ogosdp3gkbvlq2wahn66svkpaxdyu2a2br36uu7jkemd4i fetchai/protocols/oef_search,bafybeihdy3p7hjlh2vjkehfer5gfgjvqb666faupv4e7hgnxpgz2r7rwai fetchai/protocols/state_update,bafybeib736dqbkd43sz5hpb3yd4kviv2b4g2okirknn3vsdo5tlykuu4bu -fetchai/protocols/tac,bafybeiawv2dhrr4yao5z3nonw6a2qcnygdulzocbpxy63tykpzdy547iiy +fetchai/protocols/tac,bafybeidu6vbuql7kwze5fieu6s6dgzi2bymswoomd7ay6alyhfqtp2vdbq fetchai/skills/echo,bafybeice3v5erl4rdm3fjtakyfckm4wjq3accn5ajzkhjnyhbtfqm2cana fetchai/skills/erc1155_client,bafybeigbtdqu56ytjtnapjbbctmx5xtpto2d4d37ylb5ogmplqesbacply fetchai/skills/erc1155_deploy,bafybeia3urs7i3f52pyeqjnoov7tipdbs4p5deaorntkpydsh5ccw4mcty From 2e0cc9b9457eb5f514669d3784f74b8481d97e0c Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 11:13:53 +0200 Subject: [PATCH 03/13] fix: clean up sys.modules --- tests/conftest.py | 9 +++++++++ tests/test_aea_builder.py | 3 +++ tests/test_cli/test_test.py | 11 +---------- tests/test_components/test_base.py | 3 +-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ad33026d52..4453b7c282 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,6 +34,7 @@ import threading import time from contextlib import contextmanager +from copy import copy from functools import wraps from pathlib import Path from typing import Callable, Dict, Generator, List, Optional, Tuple, cast @@ -1230,3 +1231,11 @@ def use_ipfs_daemon() -> Generator: yield ipfs_daemon.stop() + + +@pytest.fixture(scope="function") +def mock_sys_modules() -> Generator: + """Store previous content of sys.modules and restore it after test execution.""" + old_sys_modules = copy(sys.modules) + yield + sys.modules = old_sys_modules diff --git a/tests/test_aea_builder.py b/tests/test_aea_builder.py index ef3a611020..0c35ce941b 100644 --- a/tests/test_aea_builder.py +++ b/tests/test_aea_builder.py @@ -23,6 +23,7 @@ import shutil import sys import tempfile +from copy import copy from importlib import import_module from pathlib import Path from textwrap import dedent, indent @@ -907,6 +908,7 @@ def test_check_dependencies_correct(self): def test_install_dependency(self): """Test dependencies installed.""" + old_sys_modules = copy(sys.modules) package_name = "async_generator" dependency = Dependency(package_name, "==1.10") sys.modules.pop(package_name, None) @@ -935,6 +937,7 @@ def test_install_dependency(self): raise Exception("should not be raised") except ModuleNotFoundError: pass + sys.modules = old_sys_modules class TestBuildEntrypoint(AEATestCaseEmpty, CleanDirectoryClass): diff --git a/tests/test_cli/test_test.py b/tests/test_cli/test_test.py index 648644ba94..990334fff0 100644 --- a/tests/test_cli/test_test.py +++ b/tests/test_cli/test_test.py @@ -21,10 +21,9 @@ import shutil import subprocess # nosec import sys -from copy import copy from pathlib import Path from textwrap import dedent -from typing import Any, Generator, Sequence, Type +from typing import Any, Sequence, Type from unittest import mock import click.testing @@ -84,14 +83,6 @@ def fun(args) -> int: return mock.patch("aea.cli.test.pytest.main", side_effect=fun) -@pytest.fixture(scope="function") -def mock_sys_modules() -> Generator: - """Store previous content of sys.modules and restore it after test execution.""" - old_sys_modules = copy(sys.modules) - yield - sys.modules = old_sys_modules - - class BaseAEATestCommand(AEATestCaseEmpty): """Base class for tests related to the command `aea test`.""" diff --git a/tests/test_components/test_base.py b/tests/test_components/test_base.py index d1c6c9a0d1..bd206fe669 100644 --- a/tests/test_components/test_base.py +++ b/tests/test_components/test_base.py @@ -121,8 +121,7 @@ def test_load_aea_package(): load_aea_package(config) -@pytest.mark.skip("Problem in CI") -def test_load_aea_package_twice(): +def test_load_aea_package_twice(mock_sys_modules): """Test aea package load twice and ensure python objects stay the same.""" config = ConnectionConfig( "http_client", "fetchai", "0.5.0", protocols={PublicId("fetchai", "http")} From 1daf28bcf0b62e31dd8911b12efa20b094c35ef4 Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 12:28:01 +0200 Subject: [PATCH 04/13] chore: learn more about failing tests --- tests/test_components/test_base.py | 8 +++++++- tests/test_launcher.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_components/test_base.py b/tests/test_components/test_base.py index bd206fe669..9c9ff0ad38 100644 --- a/tests/test_components/test_base.py +++ b/tests/test_components/test_base.py @@ -23,6 +23,7 @@ import os import re import sys +from copy import copy from itertools import zip_longest from pathlib import Path from textwrap import dedent @@ -129,12 +130,17 @@ def test_load_aea_package_twice(mock_sys_modules): config.directory = ( Path(ROOT_DIR) / "packages" / "fetchai" / "connections" / "http_client" ) + first_sys_modules = copy(sys.modules) + # ensure package not in `sys.modules` sys.modules.pop("packages.fetchai.connections.http_client.connection", None) load_aea_package(config) assert "packages.fetchai.connections.http_client.connection" not in sys.modules from packages.fetchai.connections.http_client.connection import HTTPClientConnection - assert "packages.fetchai.connections.http_client.connection" in sys.modules + second_sys_modules = copy(sys.modules) + diff = second_sys_modules.keys() - first_sys_modules.keys() + print(diff) + assert "packages.fetchai.connections.http_client.connection" in sys.modules, diff BaseHTTPCLientConnection = HTTPClientConnection load_aea_package(config) from packages.fetchai.connections.http_client.connection import HTTPClientConnection diff --git a/tests/test_launcher.py b/tests/test_launcher.py index b633950689..3c87b04fae 100644 --- a/tests/test_launcher.py +++ b/tests/test_launcher.py @@ -21,6 +21,7 @@ import shutil import time from multiprocessing import Event +from multiprocessing.managers import DictProxy # type: ignore # noqa: F401 from pathlib import Path from threading import Thread from unittest.mock import patch From 7705a3234d70be40e2e2f502e8927205bde0f101 Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 13:57:16 +0200 Subject: [PATCH 05/13] chore: update tox.ini --- tests/data/dummy_aea/aea-config.yaml | 2 +- tox.ini | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/data/dummy_aea/aea-config.yaml b/tests/data/dummy_aea/aea-config.yaml index 560840d36d..ed72126052 100644 --- a/tests/data/dummy_aea/aea-config.yaml +++ b/tests/data/dummy_aea/aea-config.yaml @@ -43,4 +43,4 @@ type: skill models: scaffold: args: - recursive: {} \ No newline at end of file + recursive: {} diff --git a/tox.ini b/tox.ini index 478fed4406..f5cedf46b9 100644 --- a/tox.ini +++ b/tox.ini @@ -366,7 +366,9 @@ commands = python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-cosmos python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs - pytest -rfE --doctest-modules aea packages/fetchai/connections packages/fetchai/protocols packages/fetchai/skills tests/ --cov=aea --cov=packages/fetchai/connections --cov=packages/fetchai/contracts --cov=packages/fetchai/protocols --cov=packages/fetchai/skills --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc {posargs} + + aea test packages {posargs} + pytest -rfE --doctest-modules aea tests/ --cov=aea --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc --cov-append {posargs} [testenv:py3.7] basepython = python3.7 From c12d8685a1a63a2c523bedfe22f0ec1f1317c274 Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 17:16:21 +0200 Subject: [PATCH 06/13] chore: try CI without package tests --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index f5cedf46b9..dff76f1575 100644 --- a/tox.ini +++ b/tox.ini @@ -56,7 +56,7 @@ commands = python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs - aea test packages {posargs} + ; aea test packages {posargs} pytest -rfE --doctest-modules aea tests/ --cov=aea --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc --cov-append {posargs} [plugins] @@ -367,7 +367,7 @@ commands = python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs - aea test packages {posargs} + ; aea test packages {posargs} pytest -rfE --doctest-modules aea tests/ --cov=aea --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc --cov-append {posargs} [testenv:py3.7] From 52d26a06c10ada4e7d3a461c761bf2757fc5d1ff Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 21:49:27 +0200 Subject: [PATCH 07/13] refactor: load twice test change --- tests/test_components/test_base.py | 33 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/test_components/test_base.py b/tests/test_components/test_base.py index 9c9ff0ad38..38bb4e4d99 100644 --- a/tests/test_components/test_base.py +++ b/tests/test_components/test_base.py @@ -19,6 +19,7 @@ # ------------------------------------------------------------------------------ """This module contains tests for aea/components/base.py""" +import inspect import itertools import os import re @@ -122,7 +123,7 @@ def test_load_aea_package(): load_aea_package(config) -def test_load_aea_package_twice(mock_sys_modules): +def test_load_aea_package_twice(): """Test aea package load twice and ensure python objects stay the same.""" config = ConnectionConfig( "http_client", "fetchai", "0.5.0", protocols={PublicId("fetchai", "http")} @@ -131,17 +132,27 @@ def test_load_aea_package_twice(mock_sys_modules): Path(ROOT_DIR) / "packages" / "fetchai" / "connections" / "http_client" ) first_sys_modules = copy(sys.modules) - # ensure package not in `sys.modules` - sys.modules.pop("packages.fetchai.connections.http_client.connection", None) - load_aea_package(config) - assert "packages.fetchai.connections.http_client.connection" not in sys.modules - from packages.fetchai.connections.http_client.connection import HTTPClientConnection + # It doesn't matter if the package is already loaded. + # We cannot safely remove it as references to other modules + # would persist and get stale. + if "packages.fetchai.connections.http_client.connection" not in sys.modules: + load_aea_package(config) + assert "packages.fetchai.connections.http_client.connection" not in sys.modules + from packages.fetchai.connections.http_client.connection import ( + HTTPClientConnection, + ) - second_sys_modules = copy(sys.modules) - diff = second_sys_modules.keys() - first_sys_modules.keys() - print(diff) - assert "packages.fetchai.connections.http_client.connection" in sys.modules, diff - BaseHTTPCLientConnection = HTTPClientConnection + assert "packages.fetchai.connections.http_client.connection" in sys.modules + BaseHTTPCLientConnection = HTTPClientConnection + else: + members = inspect.getmembers( + sys.modules["packages.fetchai.connections.http_client.connection"], + inspect.isclass, + ) + BaseHTTPCLientConnection = [ + pairs[1] for pairs in members if pairs[0] == "HTTPClientConnection" + ] + # second time load_aea_package(config) from packages.fetchai.connections.http_client.connection import HTTPClientConnection From 433ddb0f367a600b4b893c6c3716b836f25f2f3c Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 21:49:49 +0200 Subject: [PATCH 08/13] chore: split packages out in tox.ini --- .github/workflows/workflow.yml | 18 ++++++++--- tox.ini | 59 +++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 3baaf31031..c6c2daebe8 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -322,8 +322,10 @@ jobs: wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip unzip protoc-3.19.4-linux-x86_64.zip -d protoc sudo mv protoc/bin/protoc /usr/local/bin/protoc - - name: Async integration tests + - name: Framework integration tests run: tox -e py3.10 -- -m 'integration and not unstable and not ledger and not profiling' + - name: Packages integration tests + run: tox -e packages-py3.10 -- -m 'integration and not unstable and not ledger and not profiling' profiling_checks: continue-on-error: True @@ -354,7 +356,7 @@ jobs: wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-x86_64.zip unzip protoc-3.19.4-linux-x86_64.zip -d protoc sudo mv protoc/bin/protoc /usr/local/bin/protoc - - name: Async integration tests + - name: Framework integration tests run: tox -e py3.10 -- -m 'profiling' integration_checks_ledger: @@ -379,8 +381,10 @@ jobs: sudo apt-get autoremove sudo apt-get autoclean pip install tox - - name: Integration tests + - name: Framework integration tests run: tox -e py3.10 -- -m 'integration and not unstable and ledger and not profiling' + - name: Packages integration tests + run: tox -e packages-py3.10 -- -m 'integration and not unstable and ledger and not profiling' platform_checks: continue-on-error: True @@ -478,10 +482,13 @@ jobs: ipfs init - if: True - name: Unit tests + name: Framework unit tests run: | tox -e py${{ matrix.python_version }} -- -m 'not integration and not unstable and not profiling' - - name: Plugin tests + - name: Packages unit tests + run: | + tox -e packages-py${{ matrix.python_version }} -- -m 'not integration and not unstable and not profiling' + - name: Plugin unit tests run: | tox -e plugins-py${{ matrix.python_version }} -- -m 'not integration and not unstable and not profiling' @@ -546,6 +553,7 @@ jobs: run: | tox -e py3.10-cov -- --ignore=tests/test_docs --ignore=tests/test_examples --ignore=tests/test_packages/test_skills_integration -m 'not unstable' tox -e plugins-py3.10-cov -- --cov-append -m 'not unstable' + tox -e packages-py3.10-cov -- --cov-append -m 'not unstable' continue-on-error: true - name: Show full coverage report run: | diff --git a/tox.ini b/tox.ini index dff76f1575..83a71a89c6 100644 --- a/tox.ini +++ b/tox.ini @@ -47,6 +47,8 @@ deps = pycryptodome>=3.10.1 cosmpy>=0.4.1,<0.5.0 setuptools==59.6.0 + +[framework] commands = ; for some reason tox installs aea without respect to the dependencies version specified in seetup.py. at least in CI env ; so install current aea in a normal way @@ -55,10 +57,19 @@ commands = python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-cosmos python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs - - ; aea test packages {posargs} pytest -rfE --doctest-modules aea tests/ --cov=aea --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc --cov-append {posargs} +[packages] +commands = + ; for some reason tox installs aea without respect to the dependencies version specified in seetup.py. at least in CI env + ; so install current aea in a normal way + pip install {toxinidir}[all] + python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-ethereum + python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-cosmos + python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai + python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs + aea test packages {posargs} + [plugins] commands = python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-ethereum @@ -72,14 +83,21 @@ commands = [testenv:py3.10] basepython = python3.10 -deps = - {[testenv]deps} +commands = {[framework]commands} [testenv:py3.10-cov] basepython = python3.10 usedevelop = True -deps = - {[testenv]deps} +commands = {[framework]commands} + +[testenv:packages-py3.10] +basepython = python3.10 +commands = {[packages]commands} + +[testenv:packages-py3.10-cov] +basepython = python3.10 +usedevelop = True +commands = {[packages]commands} [testenv:plugins-py3.10] basepython = python3.10 @@ -357,34 +375,37 @@ deps = pycryptodome>=3.10.1 cosmpy>=0.4.1,<0.5.0 setuptools==59.6.0 -commands = - ; for some reason tox installs aea without respect to the dependencies version specified in seetup.py. at least in CI env - ; so install current aea in a normal way - python --version - pip install {toxinidir}[all] - python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-ethereum - python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-cosmos - python -m pip install --no-deps file://{toxinidir}/plugins/aea-ledger-fetchai - python -m pip install --no-deps file://{toxinidir}/plugins/aea-cli-ipfs - - ; aea test packages {posargs} - pytest -rfE --doctest-modules aea tests/ --cov=aea --cov-report=html --cov-report=xml --cov-report=term --cov-report=term-missing --cov-config=.coveragerc --cov-append {posargs} [testenv:py3.7] basepython = python3.7 deps = {[testenv_multi]deps} -commands = {[testenv_multi]commands} +commands = {[framework]commands} + +[testenv:packages-py3.7] +basepython = python3.7 +deps = {[testenv_multi]deps} +commands = {[packages]commands} [testenv:py3.8] basepython = python3.8 deps = {[testenv_multi]deps} commands = {[testenv_multi]commands} +[testenv:packages-py3.8] +basepython = python3.8 +deps = {[testenv_multi]deps} +commands = {[packages]commands} + [testenv:py3.9] basepython = python3.9 deps = {[testenv_multi]deps} commands = {[testenv_multi]commands} +[testenv:packages-py3.9] +basepython = python3.9 +deps = {[testenv_multi]deps} +commands = {[packages]commands} + [testenv:plugins-py3.7] basepython = python3.7 deps = {[testenv_multi]deps} From 05fb79a63084693b2e169c306827df4e53fffa3b Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 21:54:30 +0200 Subject: [PATCH 09/13] fix: tox.ini bug --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 83a71a89c6..5390e70e89 100644 --- a/tox.ini +++ b/tox.ini @@ -389,7 +389,7 @@ commands = {[packages]commands} [testenv:py3.8] basepython = python3.8 deps = {[testenv_multi]deps} -commands = {[testenv_multi]commands} +commands = {[framework]commands} [testenv:packages-py3.8] basepython = python3.8 @@ -399,7 +399,7 @@ commands = {[packages]commands} [testenv:py3.9] basepython = python3.9 deps = {[testenv_multi]deps} -commands = {[testenv_multi]commands} +commands = {[framework]commands} [testenv:packages-py3.9] basepython = python3.9 From a2088348c7ceacd3a87cf8f922da2e6cbead8d8b Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Mon, 5 Sep 2022 22:23:41 +0200 Subject: [PATCH 10/13] chore: add missing init files --- deploy-image/build.sh | 2 +- docs/echo_demo.md | 2 +- docs/gym-skill.md | 2 +- docs/http-echo-demo.md | 2 +- docs/quickstart.md | 2 +- .../fetchai/agents/error_test/aea-config.yaml | 2 +- .../fetchai/agents/gym_aea/aea-config.yaml | 12 ++-- .../agents/my_first_aea/aea-config.yaml | 10 +-- .../fetchai/connections/gym/connection.yaml | 2 +- .../connections/http_client/connection.yaml | 2 +- .../connections/http_server/connection.yaml | 2 +- .../connections/ledger/connection.yaml | 2 +- .../fetchai/connections/local/connection.yaml | 6 +- .../fetchai/connections/stub/connection.yaml | 2 +- .../fetchai/protocols/default/protocol.yaml | 1 + .../protocols/default/tests/__init__.py | 20 ++++++ packages/fetchai/protocols/fipa/protocol.yaml | 1 + .../fetchai/protocols/fipa/tests/__init__.py | 20 ++++++ packages/fetchai/protocols/gym/protocol.yaml | 1 + .../fetchai/protocols/gym/tests/__init__.py | 20 ++++++ packages/fetchai/protocols/http/protocol.yaml | 1 + .../fetchai/protocols/http/tests/__init__.py | 20 ++++++ .../protocols/ledger_api/protocol.yaml | 1 + .../protocols/ledger_api/tests/__init__.py | 20 ++++++ .../protocols/oef_search/protocol.yaml | 1 + .../protocols/oef_search/tests/__init__.py | 20 ++++++ .../protocols/state_update/protocol.yaml | 1 + .../protocols/state_update/tests/__init__.py | 20 ++++++ packages/fetchai/protocols/tac/protocol.yaml | 1 + .../fetchai/protocols/tac/tests/__init__.py | 20 ++++++ packages/fetchai/skills/echo/skill.yaml | 2 +- .../fetchai/skills/erc1155_client/skill.yaml | 12 ++-- .../fetchai/skills/erc1155_deploy/skill.yaml | 12 ++-- packages/fetchai/skills/error/skill.yaml | 2 +- .../skills/fipa_dummy_buyer/skill.yaml | 2 +- .../fetchai/skills/generic_buyer/skill.yaml | 12 ++-- .../fetchai/skills/generic_seller/skill.yaml | 10 +-- packages/fetchai/skills/gym/skill.yaml | 6 +- packages/fetchai/skills/http_echo/skill.yaml | 4 +- packages/hashes.csv | 62 +++++++++---------- .../open_aea/agents/gym_aea/aea-config.yaml | 12 ++-- .../open_aea/agents/http_echo/aea-config.yaml | 10 +-- .../agents/my_first_aea/aea-config.yaml | 10 +-- .../open_aea/protocols/signing/protocol.yaml | 1 + .../protocols/signing/tests/__init__.py | 20 ++++++ .../valory/protocols/tendermint/protocol.yaml | 1 + .../protocols/tendermint/tests/__init__.py | 20 ++++++ tests/test_components/test_base.py | 2 - .../test_bash_yaml/md_files/bash-gym-skill.md | 2 +- .../md_files/bash-http-echo-demo.md | 2 +- .../md_files/bash-quickstart.md | 6 +- walk.py | 5 ++ 52 files changed, 323 insertions(+), 110 deletions(-) create mode 100644 packages/fetchai/protocols/default/tests/__init__.py create mode 100644 packages/fetchai/protocols/fipa/tests/__init__.py create mode 100644 packages/fetchai/protocols/gym/tests/__init__.py create mode 100644 packages/fetchai/protocols/http/tests/__init__.py create mode 100644 packages/fetchai/protocols/ledger_api/tests/__init__.py create mode 100644 packages/fetchai/protocols/oef_search/tests/__init__.py create mode 100644 packages/fetchai/protocols/state_update/tests/__init__.py create mode 100644 packages/fetchai/protocols/tac/tests/__init__.py create mode 100644 packages/open_aea/protocols/signing/tests/__init__.py create mode 100644 packages/valory/protocols/tendermint/tests/__init__.py create mode 100644 walk.py diff --git a/deploy-image/build.sh b/deploy-image/build.sh index c9c46f3413..4803f941bc 100644 --- a/deploy-image/build.sh +++ b/deploy-image/build.sh @@ -2,7 +2,7 @@ set -e # setup the agent -aea fetch open_aea/my_first_aea:0.1.0:bafybeia2h6uk25aktvzwle3nbdex7iqkf4nktgp2w2b6qbqqj3za7h7d24 --remote +aea fetch open_aea/my_first_aea:0.1.0:bafybeihpi4lbgdnjkwpgf5qpyfovs6vtvgikkr6lkhmy6w6stsuohoymwy --remote cd my_first_aea/ aea install aea build diff --git a/docs/echo_demo.md b/docs/echo_demo.md index 7b199c4ed1..f76aa69c32 100644 --- a/docs/echo_demo.md +++ b/docs/echo_demo.md @@ -7,7 +7,7 @@ This demo assumes you have followed the setup guide. The fastest way to have your first AEA is to fetch one that already exists! ``` bash -aea fetch open_aea/my_first_aea:0.1.0:bafybeia2h6uk25aktvzwle3nbdex7iqkf4nktgp2w2b6qbqqj3za7h7d24 --remote +aea fetch open_aea/my_first_aea:0.1.0:bafybeihpi4lbgdnjkwpgf5qpyfovs6vtvgikkr6lkhmy6w6stsuohoymwy --remote cd my_first_aea ``` ### Install AEA dependencies diff --git a/docs/gym-skill.md b/docs/gym-skill.md index 859183783d..23457eb2b9 100644 --- a/docs/gym-skill.md +++ b/docs/gym-skill.md @@ -19,7 +19,7 @@ Follow the Preliminaries and Date: Mon, 5 Sep 2022 23:21:29 +0200 Subject: [PATCH 11/13] fix: lint errors --- deploy-image/build.sh | 2 +- docs/echo_demo.md | 2 +- docs/gym-skill.md | 2 +- docs/http-echo-demo.md | 2 +- docs/quickstart.md | 2 +- .../fetchai/agents/error_test/aea-config.yaml | 2 +- .../fetchai/agents/gym_aea/aea-config.yaml | 10 ++-- .../agents/my_first_aea/aea-config.yaml | 8 +-- .../fetchai/connections/gym/connection.yaml | 2 +- .../connections/http_client/connection.yaml | 2 +- .../connections/http_server/connection.yaml | 2 +- .../connections/ledger/connection.yaml | 2 +- .../fetchai/connections/local/connection.yaml | 6 +- .../fetchai/connections/stub/connection.yaml | 2 +- .../fetchai/protocols/default/protocol.yaml | 2 +- .../protocols/default/tests/test_default.py | 1 + packages/fetchai/protocols/fipa/protocol.yaml | 2 +- .../fetchai/protocols/fipa/tests/test_fipa.py | 1 + packages/fetchai/protocols/gym/protocol.yaml | 2 +- .../fetchai/protocols/gym/tests/test_gym.py | 1 + packages/fetchai/protocols/http/protocol.yaml | 2 +- .../fetchai/protocols/http/tests/test_http.py | 1 + .../protocols/ledger_api/protocol.yaml | 2 +- .../ledger_api/tests/test_ledger_api.py | 1 + .../protocols/oef_search/protocol.yaml | 2 +- .../oef_search/tests/test_oef_search.py | 1 + .../protocols/state_update/protocol.yaml | 2 +- .../state_update/tests/test_state_update.py | 2 + packages/fetchai/protocols/tac/protocol.yaml | 2 +- .../fetchai/protocols/tac/tests/test_tac.py | 1 + packages/fetchai/skills/echo/skill.yaml | 2 +- .../fetchai/skills/erc1155_client/skill.yaml | 10 ++-- .../fetchai/skills/erc1155_deploy/skill.yaml | 10 ++-- packages/fetchai/skills/error/skill.yaml | 2 +- .../skills/fipa_dummy_buyer/skill.yaml | 2 +- .../fetchai/skills/generic_buyer/skill.yaml | 10 ++-- .../fetchai/skills/generic_seller/skill.yaml | 10 ++-- packages/fetchai/skills/gym/skill.yaml | 6 +- packages/fetchai/skills/http_echo/skill.yaml | 4 +- packages/hashes.csv | 60 +++++++++---------- .../open_aea/agents/gym_aea/aea-config.yaml | 10 ++-- .../open_aea/agents/http_echo/aea-config.yaml | 8 +-- .../agents/my_first_aea/aea-config.yaml | 8 +-- .../valory/protocols/tendermint/protocol.yaml | 2 +- .../tendermint/tests/test_tendermint.py | 1 + .../test_bash_yaml/md_files/bash-gym-skill.md | 2 +- .../md_files/bash-http-echo-demo.md | 2 +- .../md_files/bash-quickstart.md | 6 +- 48 files changed, 118 insertions(+), 108 deletions(-) diff --git a/deploy-image/build.sh b/deploy-image/build.sh index 4803f941bc..003c27a9ed 100644 --- a/deploy-image/build.sh +++ b/deploy-image/build.sh @@ -2,7 +2,7 @@ set -e # setup the agent -aea fetch open_aea/my_first_aea:0.1.0:bafybeihpi4lbgdnjkwpgf5qpyfovs6vtvgikkr6lkhmy6w6stsuohoymwy --remote +aea fetch open_aea/my_first_aea:0.1.0:bafybeidqq73k63tr5baafodg3w5xy3g5so45k5wn2rpo7plkeiq3ojdxfu --remote cd my_first_aea/ aea install aea build diff --git a/docs/echo_demo.md b/docs/echo_demo.md index f76aa69c32..c684c41355 100644 --- a/docs/echo_demo.md +++ b/docs/echo_demo.md @@ -7,7 +7,7 @@ This demo assumes you have followed the setup guide. The fastest way to have your first AEA is to fetch one that already exists! ``` bash -aea fetch open_aea/my_first_aea:0.1.0:bafybeihpi4lbgdnjkwpgf5qpyfovs6vtvgikkr6lkhmy6w6stsuohoymwy --remote +aea fetch open_aea/my_first_aea:0.1.0:bafybeidqq73k63tr5baafodg3w5xy3g5so45k5wn2rpo7plkeiq3ojdxfu --remote cd my_first_aea ``` ### Install AEA dependencies diff --git a/docs/gym-skill.md b/docs/gym-skill.md index 23457eb2b9..da33cf7a67 100644 --- a/docs/gym-skill.md +++ b/docs/gym-skill.md @@ -19,7 +19,7 @@ Follow the Preliminaries and Date: Tue, 6 Sep 2022 09:18:04 +0200 Subject: [PATCH 12/13] fix: test typo --- aea/configurations/constants.py | 2 +- tests/test_components/test_base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aea/configurations/constants.py b/aea/configurations/constants.py index 4767deaec3..518512eade 100644 --- a/aea/configurations/constants.py +++ b/aea/configurations/constants.py @@ -29,7 +29,7 @@ _COSMOS_IDENTIFIER = "cosmos" SIGNING_PROTOCOL = "open_aea/signing:latest" SIGNING_PROTOCOL_WITH_HASH = ( - "open_aea/signing:1.0.0:bafybeihjlpgjm5vkg6kxm66a5k2r357dadnsjfpddta2mzd2bshstv6vdi" + "open_aea/signing:1.0.0:bafybeiambqptflge33eemdhis2whik67hjplfnqwieoa6wblzlaf7vuo44" ) DEFAULT_LEDGER = _ETHEREUM_IDENTIFIER PRIVATE_KEY_PATH_SCHEMA = "{}_private_key.txt" diff --git a/tests/test_components/test_base.py b/tests/test_components/test_base.py index 8c3b375578..95904fbc6a 100644 --- a/tests/test_components/test_base.py +++ b/tests/test_components/test_base.py @@ -149,7 +149,7 @@ def test_load_aea_package_twice(): ) BaseHTTPCLientConnection = [ pairs[1] for pairs in members if pairs[0] == "HTTPClientConnection" - ] + ][0] # second time load_aea_package(config) from packages.fetchai.connections.http_client.connection import HTTPClientConnection From 3a17c088ae3981e313787dcb7798bb9fd0d407f8 Mon Sep 17 00:00:00 2001 From: David Minarsch Date: Tue, 6 Sep 2022 11:50:20 +0200 Subject: [PATCH 13/13] chore: v1.18.0.post1 --- HISTORY.md | 11 +++++++++++ aea/__version__.py | 2 +- deploy-image/Dockerfile | 2 +- deploy-image/README.md | 2 +- develop-image/docker-env.sh | 2 +- examples/tac_deploy/Dockerfile | 2 +- scripts/install.ps1 | 2 +- scripts/install.sh | 2 +- skaffold.yaml | 4 ++-- .../test_bash_yaml/md_files/bash-quickstart.md | 2 +- user-image/docker-env.sh | 2 +- walk.py | 5 ----- 12 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 walk.py diff --git a/HISTORY.md b/HISTORY.md index a29ca8e5c5..d91b961535 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,16 @@ # Release History - open AEA +## 1.18.0.post1 (2022-09-06) + +AEA: +- Reverts a problematic package loading logic introduced in `1.18.0` + +Tests: +- Fixes flaky tests + +Chores: +- Restructures CI to avoid environment cross-effects between the package and framework tests + ## 1.18.0 (2022-09-04) AEA: diff --git a/aea/__version__.py b/aea/__version__.py index ffd3523263..e7186d16fa 100644 --- a/aea/__version__.py +++ b/aea/__version__.py @@ -23,7 +23,7 @@ __title__ = "open-aea" __description__ = "Open Autonomous Economic Agent framework (without vendor lock-in)" __url__ = "https://github.com/valory-xyz/open-aea.git" -__version__ = "1.18.0" +__version__ = "1.18.0.post1" __author__ = "Valory AG" __license__ = "Apache-2.0" __copyright__ = "2021 Valory AG, 2019 Fetch.AI Limited" diff --git a/deploy-image/Dockerfile b/deploy-image/Dockerfile index c651288765..e9f3f195d3 100644 --- a/deploy-image/Dockerfile +++ b/deploy-image/Dockerfile @@ -16,7 +16,7 @@ RUN apk add --no-cache go # aea installation RUN pip install --upgrade pip -RUN pip install --upgrade --force-reinstall open-aea[all]==1.18.0 "open-aea-cli-ipfs<2.0.0,>=1.18.0" +RUN pip install --upgrade --force-reinstall open-aea[all]==1.18.0.post1 "open-aea-cli-ipfs<2.0.0,>=1.18.0" # directories and aea cli config WORKDIR /home/agents diff --git a/deploy-image/README.md b/deploy-image/README.md index 287b752aba..a865977c6a 100644 --- a/deploy-image/README.md +++ b/deploy-image/README.md @@ -11,7 +11,7 @@ The example uses the `fetchai/my_first_aea` project. You will likely want to mod Install subversion, then download the example directory to your local working directory ``` bash -svn checkout https://github.com/valory-xyz/open-aea/tags/v1.18.0/packages packages +svn checkout https://github.com/valory-xyz/open-aea/tags/v1.18.0.post1/packages packages ``` ### Modify scripts diff --git a/develop-image/docker-env.sh b/develop-image/docker-env.sh index b483f11d27..073be51626 100755 --- a/develop-image/docker-env.sh +++ b/develop-image/docker-env.sh @@ -1,7 +1,7 @@ #!/bin/bash # Swap the following lines if you want to work with 'latest' -DOCKER_IMAGE_TAG=valory/open-aea-develop:1.18.0 +DOCKER_IMAGE_TAG=valory/open-aea-develop:1.18.0.post1 # DOCKER_IMAGE_TAG=valory/open-aea-develop:latest DOCKER_BUILD_CONTEXT_DIR=.. diff --git a/examples/tac_deploy/Dockerfile b/examples/tac_deploy/Dockerfile index 9754a73624..b94c5f3051 100644 --- a/examples/tac_deploy/Dockerfile +++ b/examples/tac_deploy/Dockerfile @@ -19,7 +19,7 @@ RUN apk add --no-cache go # aea installation RUN python -m pip install --upgrade pip -RUN pip install --upgrade --force-reinstall aea[all]==1.18.0 +RUN pip install --upgrade --force-reinstall aea[all]==1.18.0.post1 # directories and aea cli config COPY /.aea /home/.aea diff --git a/scripts/install.ps1 b/scripts/install.ps1 index e8ad5ad88d..90f802ea8b 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -34,7 +34,7 @@ function instal_choco_golang_gcc { } function install_aea { echo "Install aea" - $output=pip install open-aea[all]==1.18.0 --force --no-cache-dir 2>&1 |out-string; + $output=pip install open-aea[all]==1.18.0.post1 --force --no-cache-dir 2>&1 |out-string; if ($LastExitCode -ne 0) { echo $output echo "AEA install failed!" diff --git a/scripts/install.sh b/scripts/install.sh index 0a52ab4773..483d0da940 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -42,7 +42,7 @@ function is_python_version_ok() { function install_aea (){ echo "Install AEA" - output=$(pip3 install --user open-aea[all]==1.18.0 --force --no-cache-dir) + output=$(pip3 install --user open-aea[all]==1.18.0.post1 --force --no-cache-dir) if [[ $? -ne 0 ]]; then echo "$output" diff --git a/skaffold.yaml b/skaffold.yaml index fb72598f90..a2fc39f0eb 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -5,7 +5,7 @@ metadata: build: tagPolicy: envTemplate: - template: "1.18.0" + template: "1.18.0.post1" artifacts: - image: valory/open-aea-develop docker: @@ -24,7 +24,7 @@ profiles: build: tagPolicy: envTemplate: - template: "1.18.0" + template: "1.18.0.post1" artifacts: - image: valory/open-aea-docs docker: diff --git a/tests/test_docs/test_bash_yaml/md_files/bash-quickstart.md b/tests/test_docs/test_bash_yaml/md_files/bash-quickstart.md index a2ca0e12fd..2591edd527 100644 --- a/tests/test_docs/test_bash_yaml/md_files/bash-quickstart.md +++ b/tests/test_docs/test_bash_yaml/md_files/bash-quickstart.md @@ -44,7 +44,7 @@ pip install open-aea[all] pip install open-aea-cli-ipfs ``` ``` -svn checkout https://github.com/valory-xyz/open-aea/tags/v1.18.0/packages packages +svn checkout https://github.com/valory-xyz/open-aea/tags/v1.18.0.post1/packages packages ``` ``` bash diff --git a/user-image/docker-env.sh b/user-image/docker-env.sh index 4ea7ab9a92..b987032aad 100644 --- a/user-image/docker-env.sh +++ b/user-image/docker-env.sh @@ -1,7 +1,7 @@ #!/bin/bash # Swap the following lines if you want to work with 'latest' -DOCKER_IMAGE_TAG=valory/open-aea-user:1.18.0 +DOCKER_IMAGE_TAG=valory/open-aea-user:1.18.0.post1 # DOCKER_IMAGE_TAG=valory/open-aea-user:latest DOCKER_BUILD_CONTEXT_DIR=.. diff --git a/walk.py b/walk.py deleted file mode 100644 index a0eb0bc593..0000000000 --- a/walk.py +++ /dev/null @@ -1,5 +0,0 @@ -import os - -for dir, sub_dirs, files in os.walk("packages"): - if "__init__.py" not in files: - print(dir) \ No newline at end of file