ethereum / lahja

Lahja is a generic multi process event bus implementation written in Python 3.6+ to enable lightweight inter-process communication, based on non-blocking asyncio
MIT License
394 stars 19 forks source link

Declarative cross implementation test suite tools #140

Closed pipermerriam closed 5 years ago

pipermerriam commented 5 years ago

What was wrong?

How can it be fixed?

I've been imagining this concept that I'll call an "Endpoint Driver". It would be a declarative, implementation agnostic mechanism for defining a sequential set of actions that should be taken on an endpoint, with one of those actions being something like just running python code.

This tool should allow us to write implementation agnostic tests allowing us to define our test suite once and run it across any number of different combinations like:

I suspect the tests will be much more readable too.

pipermerriam commented 5 years ago
server_driver = compose_driver(
    connect_until_connected_to(client_config),
    wait_for(SomeEvent).add_handler(lambda ev: assert isinstance(ev, SomeEvent)),
)
client_driver = compose_driver(
    connect_to_endpoint(server_config),
    broadcast(SomeEvent()),
)

Then there's probably a backend type component for how to run each endpoint type as well as something to manage doing things in their own processes.

pipermerriam commented 5 years ago

Done with #141 opening new issues to convert the rest of the test suite to use this...