Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with pytest-xdist? #58

Closed
dz0 opened this issue May 10, 2023 · 2 comments
Closed

How to use with pytest-xdist? #58

dz0 opened this issue May 10, 2023 · 2 comments

Comments

@dz0
Copy link

dz0 commented May 10, 2023

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?

@yvaucher
Copy link
Member

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.

@yvaucher
Copy link
Member

yvaucher commented Oct 7, 2024

Check #77

@yvaucher yvaucher closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants