pytest-odoo
pytest-odoo copied to clipboard
How to use with pytest-xdist?
Hi,
I'd like to use it with pytest-xdist, but get Deadlocks because of simultaneus updates.
As I have my fresh DB (with demo data) ready before calling pytest --
I could automatically copy it for each worker (example like here) .
I can get each worker like this and use it for separate DB naming.
But how then pass those separate db-names to pytest-odoo separate processes?
IIUC pytest-xdist will dispatch all tests randomly to workers. Which could be an issue with database transactions.
It would require to make pytest-xdist know about SavepointCase and SingleTransactionCase. As it needs to be aware of when the savepoint and rollback, making it impossible in somecase to parallelize fully a test suite.
For SavepointCase (which nowadays is the default), it would most likely require to distribute the tests to the CPUs after the setupClass is done.
For SingleTransactionCase, it needs to be sequential.