Questions tagged [pytest-xdist]

pytest-xdist is a pytest plugin which allows test execution in parallel. Paralellization works both by running a configurable number of processes on the same host, and across multiple hosts. It also supports running tests on multiple platforms and Python interpreters in parallel. Additionally, it supports automatic re-running of failed tests.

Reference:

88 questions
0
votes
0 answers

Flask Testing with SQLite DB, deleting not working

In order to test my flask application, I setup a local SQLite DB with create_engine. To delete, I have my route call TablesEtl().delete_record_by_id(). class TablesEtl: def __init__(self) -> None: self.engine =…
Rafael
  • 1
  • 1
0
votes
0 answers

Constantly hanging test run with the plugin

We are using: platform linux -- Python 3.9.5, pytest-6.2.5, py-1.10.0, pluggy-0.13.1 plugins: forked-1.4.0, xdist-2.5.0, pytest_check-1.0.4, teamcity-messages-1.29, anyio-3.3.4, testrail-2.9.1, dependency-0.5.1 When trying to execute pytest using…
0
votes
1 answer

When trying to run parallel tests on same browser I seem to run only 2 max

Here's my command : pytest -v -s -n=4 test_Cases/test_login.py --browser chrome Here's the output: plugins: xdist-3.1.0, html-3.2.0, metadata-2.0.4 [gw0] darwin Python 3.8.0 cwd: /Users/georgeashraf/My- …
0
votes
2 answers

Appium + Python(pytest) Parallel Testing Using Parameterization Problem

I am writing through Google Translate, so the sentence may not be smooth. sorry. I'm using appium,pytest to create mobile test automation. Using the "Devices" dictionary I want to freely control the parallel test. During parallel testing, to…
0
votes
1 answer

pytest-xdist - running parametrized fixtures for parametrized tests once without blocking

Consider the following example (which is a simple template of my real issue, of course): import time import pytest @pytest.fixture(scope="session", params=[1, 2, 3, 4, 5]) def heavy_computation(request): print(f"heavy_computation - param is…
noamgot
  • 3,962
  • 4
  • 24
  • 44
0
votes
0 answers

pytest --forked flag processes don't die causing GitLab build to hang

We are using pytest-xdist to run pytest tests with the --forked flag (we are writing integration tests for code that uses Scrapy). However, we noticed that when the tests finish running, some of the created child processes remain alive, which causes…
Dean Gurvitz
  • 854
  • 1
  • 10
  • 24
0
votes
0 answers

pytest: Transfer some tests from one thread to another thread

I have some accounts as json file. It look like: "accounts": [ { "email": "email1", "password": "qwerty", "is_busy": false }, { "email": "email2", "password": "qwerty", "is_busy": false }, { …
0
votes
0 answers

How to call tear down for each test running in parallel with pytest-xdist?

For each test case, I clean all tables in database using the teardown method. Unfortunately, this method is not called after test case execution when the tests run in parallel, resulting in database errors. The test steps are: Create database ->…
Angelo Mendes
  • 905
  • 13
  • 24
0
votes
1 answer

Deadlock when running celery tests under pytest with xdist

If I run without xdist involved, like this: pytest --disable-warnings --verbose -s test_celery_chords.py Works just fine. I see the DB created, the tasks run and it exits as expected. If I run with xdist involved (-n 2), like this: pytest…
boatcoder
  • 17,525
  • 18
  • 114
  • 178
0
votes
0 answers

Run pytest xdist tests in a cluster

Is it possible to distribute pytest test cases across multiple different computers in the same network (in a cluster)? I've been using pytest and the xdist plugin for quite some time and would like to scope out the possibility of adding an…
orange
  • 7,755
  • 14
  • 75
  • 139
0
votes
0 answers

Why some testcases fail in Pytest even after their dependencies have run successfully before them?

I have been trying to run some testcases which are dependent on other testcases. So, I made sure to use the pytest.mark.dependency marker and also made sure that the dependencies (the ones upon which the cases are dependent) execute before the…
0
votes
0 answers

pytest_configuration runs several times when using pytest-xdist

In my conftest.py i have pytest_configuration hook that runs some APIs before executing tests to configure stuff. All is working as expected until i use pytest-xdist to run tests in parallel. In this case, my hook is executed n+1 times, according to…
YuMa
  • 77
  • 5
0
votes
0 answers

Running parallel test suites using pytest without reordering tests in each of test suite

I am trying to execute multiple pytest suites at a time i.e parallel execution using pytest-xdist package using pytest. For example, I've two test suites test_one.py test_two.py pytest test_one.py test_two.py -n 2 However, this is randomly…
0
votes
0 answers

pytest cannot find database and tables

I am trying to speed up the test runtime by using pytest-xdist, previously I was using pytest, pytest-django to run the tests, After installing pytest-xdist, One is an issue which I am facing is most of the tests are failing with messages that…
navyad
  • 3,752
  • 7
  • 47
  • 88
0
votes
1 answer

Multithread Pytest

I wanted to create a test in PyTest where it will parallelly open two Chrome and Firefox browser and test two test cases one by one with valid and invalid sets of inputs. How should I achieve it? Thanks for your advanced help.