Skip to content

plugins.aea-test-autonomy.aea_test_autonomy.fixture_helpers

This module contains helper classes/functions for fixtures.

tendermint_port

@pytest.fixture(scope="session")
def tendermint_port() -> int

Get the Tendermint port

abci_host

@pytest.fixture(scope="session")
def abci_host() -> str

Get the ABCI host

abci_port

@pytest.fixture(scope="session")
def abci_port() -> int

Get the ABCI port

tendermint

@pytest.fixture(scope="class")
def tendermint(tendermint_port: int, abci_host: str, abci_port: int, timeout: float = 2.0, max_attempts: int = 10) -> Generator

Launch the Ganache image.

UseTendermint Objects

@pytest.mark.integration
class UseTendermint()

Inherit from this class to use Tendermint.

abci_host

@property
def abci_host() -> str

Get the abci host address.

abci_port

@property
def abci_port() -> int

Get the abci port.

node_address

@property
def node_address() -> str

Get the node address.

nb_nodes

@pytest.fixture
def nb_nodes(request: Any) -> int

Get a parametrized number of nodes.

flask_tendermint

@pytest.fixture
def flask_tendermint(tendermint_port: int, nb_nodes: int, abci_host: str, abci_port: int, timeout: float = 2.0, max_attempts: int = 10) -> Generator[FlaskTendermintDockerImage, None, None]

Launch the Flask server with Tendermint container.

UseFlaskTendermintNode Objects

@pytest.mark.integration
class UseFlaskTendermintNode()

Inherit from this class to use flask server with Tendermint.

p2p_seeds

@property
def p2p_seeds() -> List[str]

Get the p2p seeds.

get_node_name

def get_node_name(i: int) -> str

Get the node's name.

get_abci_port

def get_abci_port(i: int) -> int

Get the ith rpc port.

get_port

def get_port(i: int) -> int

Get the ith port.

get_com_port

def get_com_port(i: int) -> int

Get the ith com port.

get_laddr

def get_laddr(i: int, p2p: bool = False) -> str

Get the ith rpc port.

health_check

def health_check(**kwargs: Any) -> None

Perform a health check.

ganache_addr

@pytest.fixture(scope="session")
def ganache_addr() -> str

HTTP address to the Ganache node.

ganache_port

@pytest.fixture(scope="session")
def ganache_port() -> int

Port of the connection to the Ganache Node to use during the tests.

ganache_configuration

@pytest.fixture(scope="session")
def ganache_configuration() -> Dict

Get the Ganache configuration for testing purposes.

ganache_scope_function

@pytest.fixture(scope="function")
def ganache_scope_function(ganache_configuration: Dict, ganache_addr: str, ganache_port: int, timeout: float = 2.0, max_attempts: int = 10) -> Generator

Launch the Ganache image. This fixture is scoped to a function which means it will destroyed at the end of the test.

ganache_scope_class

@pytest.fixture(scope="class")
def ganache_scope_class(ganache_configuration: Dict, ganache_addr: str, ganache_port: int, timeout: float = 2.0, max_attempts: int = 10) -> Generator

Launch the Ganache image. This fixture is scoped to a class which means it will destroyed after running every test in a class.

ammnet_scope_class

@pytest.fixture(scope="class")
def ammnet_scope_class(timeout: float = 2.0, max_attempts: int = 20) -> Generator

Launch the Ganache image. This fixture is scoped to a class which means it will destroyed after running every test in a class.

UseGanache Objects

@pytest.mark.integration
class UseGanache()

Inherit from this class to use Ganache.

GanacheBaseTest Objects

class GanacheBaseTest(DockerBaseTest)

Base pytest class for Ganache.

setup_class_kwargs

@classmethod
def setup_class_kwargs(cls) -> Dict[str, Any]

Get kwargs for _setup_class call.

key_pairs

@classmethod
def key_pairs(cls) -> List[Tuple[str, str]]

Get the key pairs which are funded.

url

@classmethod
def url(cls) -> str

Get the url under which the image is reachable.

acn_config

@pytest.fixture(scope="session")
def acn_config() -> Dict

ACN node configuration.

acn_node

@pytest.fixture(scope="function")
def acn_node(acn_config: Dict, timeout: float = 2.0, max_attempts: int = 10) -> Generator

Launch the Ganache image.

UseACNNode Objects

@pytest.mark.integration
class UseACNNode()

Inherit from this class to use an ACNNode for a client connection

ACNNodeBaseTest Objects

class ACNNodeBaseTest(DockerBaseTest)

Base pytest class for Ganache.

setup_class_kwargs

@classmethod
def setup_class_kwargs(cls) -> Dict[str, Any]

Get kwargs for _setup_class call.

url

@classmethod
def url(cls) -> str

Get the url under which the image is reachable.

hardhat_addr

@pytest.fixture(scope="session")
def hardhat_addr() -> str

Get the hardhat addr

hardhat_port

@pytest.fixture(scope="session")
def hardhat_port() -> int

Get the hardhat port

key_pairs

@pytest.fixture(scope="session")
def key_pairs() -> List[Tuple[str, str]]

Get the default key paris for hardhat.

HardHatBaseTest Objects

class HardHatBaseTest(DockerBaseTest)

Base pytest class for HardHat.

setup_class_kwargs

@classmethod
def setup_class_kwargs(cls) -> Dict[str, Any]

Get kwargs for _setup_class call.

key_pairs

@classmethod
def key_pairs(cls) -> List[Tuple[str, str]]

Get the key pairs which are funded.

url

@classmethod
def url(cls) -> str

Get the url under which the image is reachable.

registries_scope_class

@pytest.fixture(scope="class")
def registries_scope_class(timeout: float = 2.0, max_attempts: int = 20) -> Generator

Launch the Registry contracts image. This fixture is scoped to a class which means it will destroyed after running every test in a class.

UseRegistries Objects

@pytest.mark.integration
class UseRegistries()

Inherit from this class to use a local Ethereum network with deployed registry contracts

gnosis_safe_hardhat_scope_function

@pytest.fixture(scope="function")
def gnosis_safe_hardhat_scope_function(hardhat_addr: str, hardhat_port: int, timeout: float = 3.0, max_attempts: int = 40) -> Generator

Launch the HardHat node with Gnosis Safe contracts deployed. This fixture is scoped to a function which means it will destroyed at the end of the test.

gnosis_safe_hardhat_scope_class

@pytest.fixture(scope="class")
def gnosis_safe_hardhat_scope_class(hardhat_addr: str, hardhat_port: int, timeout: float = 3.0, max_attempts: int = 40) -> Generator

Launch the HardHat node with Gnosis Safe contracts deployed.This fixture is scoped to a class which means it will destroyed after running every test in a class.

UseGnosisSafeHardHatNet Objects

@pytest.mark.integration
class UseGnosisSafeHardHatNet()

Inherit from this class to use HardHat local net with Gnosis-Safe deployed.

HardHatGnosisBaseTest Objects

class HardHatGnosisBaseTest(HardHatBaseTest)

Base pytest class for HardHat with Gnosis deployed.

HardHatAMMBaseTest Objects

class HardHatAMMBaseTest(HardHatBaseTest)

Base pytest class for HardHat with Gnosis and Uniswap deployed.

Back to top