Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion auto_dev/commands/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def test(ctx, path, watch, coverage_report) -> None:

"""
verbose = ctx.obj["VERBOSE"]

num_processes = int(ctx.obj["NUM_PROCESSES"])
click.echo(
f"Testing path: `{path or 'All dev packages/packages.json'}` ⌛",
)
Expand All @@ -117,7 +119,7 @@ def test(ctx, path, watch, coverage_report) -> None:
results = {}
for package in range(len(packages)):
click.echo(f"Testing {packages[package]} {package + 1}/{len(packages)}")
result = test_path(str(packages[package]), verbose=verbose, watch=watch, multiple=True)
result = test_path(str(packages[package]), verbose=verbose, watch=watch, multiple=True if num_processes != 1 else False)
results[packages[package]] = result
click.echo(f"{'👌' if result else '❗'} - {packages[package]}")

Expand Down
4 changes: 2 additions & 2 deletions auto_dev/data/templates/protocols/test_dialogues.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import MagicMock

from pydantic import BaseModel
from hypothesis import given, settings
from hypothesis import given, settings, HealthCheck
from hypothesis import strategies as st
from aea.configurations.data_types import PublicId

Expand Down Expand Up @@ -51,7 +51,7 @@ def validate_dialogue(performative, model):


{%- for initial_performative in initial_performatives %}
@settings(deadline=1000)
@settings(deadline=1000,suppress_health_check=[HealthCheck.too_slow])
@given(st.from_type({{ snake_to_camel(initial_performative) }}))
def test_{{ initial_performative }}_dialogues(model):
"""Test for the '{{ initial_performative|upper }}' protocol."""
Expand Down
3 changes: 2 additions & 1 deletion auto_dev/data/templates/protocols/test_messages.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from pydantic import BaseModel
from hypothesis import strategies as st
from hypothesis import given
from hypothesis import given, settings, HealthCheck

from aea.common import Address
from aea.mail.base import Envelope
Expand Down Expand Up @@ -64,6 +64,7 @@ def perform_message_test(performative, model) -> None:

{%- for performative in performative_types %}

@settings(deadline=1000,suppress_health_check=[HealthCheck.too_slow])
@given(st.from_type({{ snake_to_camel(performative) }}))
def test_{{ performative }}_messages(model):
"""Test for the '{{ performative|upper }}' protocol message encode and decode."""
Expand Down
13 changes: 10 additions & 3 deletions auto_dev/test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Module for testing the project."""

import sys
import os
from pathlib import Path
from multiprocessing import cpu_count
from importlib import invalidate_caches


import pytest

Expand All @@ -20,7 +23,7 @@ def get_test_cpu_count() -> str:


def test_path(
path: str,
path: str | list[str],
verbose: bool = False,
watch: bool = False,
multiple: bool = False,
Expand Down Expand Up @@ -53,7 +56,10 @@ def test_path(
- Integrates with coverage reporting

"""
extra_args = ["--cache-clear"]
extra_args = ["--cache-clear",
"--disable-warnings",
"--import-mode=importlib"
]

if verbose:
extra_args.append("-v")
Expand All @@ -65,7 +71,8 @@ def test_path(
extra_args.extend(("-n", get_test_cpu_count()))

args = [path, *extra_args]
os.environ["PYTHONPATH"] = "."
os.environ["PYTHONWARNINGS"] = "ignore"
sys.path.insert(0, os.getcwd())
print(f"Running tests with pytest args: {args}")
result = pytest.main(args)
return result == 0
Loading