frequenz-floss / frequenz-sdk-python

Frequenz Python Software Development Kit (SDK)
https://frequenz-floss.github.io/frequenz-sdk-python/
MIT License
13 stars 17 forks source link

Make tests independent from each other to be able to run in parallel #229

Open leandro-lucarella-frequenz opened 1 year ago

leandro-lucarella-frequenz commented 1 year ago

What's needed?

To speed up tests run, there is pytest-xdist, which lets you run tests in parallel.

But right now we can't do that because we are using some gRPC mock server that actually serves connection and when multiple tests using this run at the same time, they will share the same server and conflict.

Proposed solution

Ideally stop using the gRPC mock server and just use regular python mocks instead. If not possible maybe consider isolating the servers used in different tests or see if there is a way to declare tests dependency.

Use cases

No response

Alternatives and workarounds

No response

Additional context

With 8 cores and using 12 workers (using less workers still doesn't saturate the CPUs, I guess tests have too much wait time), tests run in 10s, while without parallelization they take 28s.

This means that when running nox, we should be able to go from 1 minutes to 20s!

llucax commented 5 months ago

When the grpc server is gone (#955) we might be able to close this one too.