Is there a way to control how pytest-xdist runs tests in parallel?

I have the following directory layout: runner.py lib/ tests/ testsuite1/ testsuite1.py testsuite2/ testsuite2.py testsuite3/ ...

Why does pytest + xdist not capture output?

I'm using pytest with pytest-xdist for parallel test running. It doesn't seem to honour the -s option for passing through the standard output to the terminal as the tests are run. Is there any way...

how to write integration tests using pytest and how to repeat the integration tests

I am new to this so please do not mind if the question is not specific enough. I want to know how to club unit tests into a single integration test in pytest. Furthermore, I would like to repeat...

How to combine py.test fixtures with Flask-SQLAlchemy and PostgreSQL?

I'm struggling to write py.test fixtures for managing my app's database that maximize speed, supports pytest-xdist parallelization of tests, and isolates the tests from each other. I'm using...

How to print output when using pytest with xdist

I'm using py.test to run tests. I'm using it with pytest-xdist to run the tests in parallel. I want to see the output of print statements in my tests. I have: Ubuntu 15.10, Python 2.7.10,...

Why does pytest-xdist make my tests run slower, not faster?

I'm porting a ~2000 method test suite from nose to pytest because django-nose didn't support parallelization well. Swapping out nose for pytest seemed to work pretty well, and after adding...

Running Pytest on Multiple Devices in Parallel

I have 3 devices connected to my computer and I want to run pytest in parallel on each of them. I there any way to do it, either with pytest or with adb? Thanks in advance.

pytest run tests parallel

I want to run all my pytest tests in parallel instead of sequentially. my current setup looks like: class Test1(OtherClass): @pytest.mark.parametrize("activity_name", ["activity1",...

pytest-xdist results in AttributeError: 'dict' object has no attribute 'style'

Currently using allure-pytest-adaptor 1.7.8, pytest 3.2.1 and pytest-xdist 1.20.0 Having the issue when I use the xdist to run tests in parallel, if I ran tests all in serial, no such issue: If...

Is it possible to execute the same test in parallel in pytest?

I understand that you can parameterize a test to repeat the test with different set of parameters. Also I know that different tests in a test file can be run in parallel using the -n, but I would...

How can I adjust the number of threads with pytest + xdist?

To run parallel tests on mobile devices, I use pytest + xdist. I want to run as many threads as I have connected devices, no more. I pass "-n 4" as command line argument, but I can't change it...

pytest fixtures and threads synchronizations

I'm trying to use pytest-xdist in order to make my tests run parallel, The issue is that each thread is going to the fixture that shared to all tests and executing it according to threads...

How to add custom sections to terminal report in pytest

In pytest, when a test case is failed, you have in the report the following categories: Failure details Captured stdout call Captured stderr call Captured log call I would like to add some...

Why do I get empty django querysets when using ThreadPoolExecutor with pytest-django?

I have been trying to track down some bugs in some concurrent code and wanted to write a test that ran a function in parallel. I am using Django with postgres as my database and testing using...

HDF5 library version error - HDF5 ver 1.10.4

I'm trying to import some packages with spyder (OS x64), Anaconda and pyton 3.x The error is pretty famous in the internet. The solution proposed is to match the version of the library 1.10.5 with...

How to execute multiple pytest suites (files) parallelly at a time

I am trying to execute multiple pytest suites at a time i.e parallel execution but I couldn't find the solution, can someone please help me with this. For example, I've two test suites 1....

How can I use pip cache in github actions?

I am having some issues with using cached pip in Github Actions. My workflow setup is name: tests on: [push, pull_request] jobs: linux: runs-on: ubuntu-18.04 strategy: ...

How to dynamically run some tests in parallel in Pytest 3.0.7

I am using Pytest 3.0.7 (in Python 2.7) and I need to be able to dynamically run selected tests in parallel without modifying the tests. Take the example code below: import time import...

Pytest: Finding when each test started and ended

I have a complex Django-Pytest test suite with lots of tests that are running in parallel processes. I'd like to see the exact timepoint at which each test started and ended. How can I get that...

How to execute tests in parallel using pytest if test file has setup & tear down section

My test script is like below @pytest.fixture(scope="Module", Autouse="True") def setup_test(): .................... yield ............ def test_1() ............... def test_2() ...

Generating Jenkins Pipeline Stages from pytest

Is it possible/is there a plugin to dynamically create jenkins pipeline stages from pytest? (run pytest in a pipeline, and then every test that pytest runs will create a new stage in the pipeline,...

pytest-parallel not honouring module-scope fixtures

Suppose I have the below test cases written in a file, test_something.py: @pytest.fixture(scope="module") def get_some_binary_file(): # Some logic here that creates a path "/a/b/bin" and then...

What is the preferred method of running background tasks in IsolatedAsyncioTestCase?

I'm using pytest 5.4.3 to run asynchronous unit tests. Typically I like to run an isolated server instance and perform the unit test cases together with the spinned up server. Currently I'm trying...

Logs are being printed twice when using logger in pytest. [I check all the stackoverflow links and non of the suggestions fixed my issue]

Logs are being printed twice when using logger in pytest. I am using a custom plugging to collect all the logs from each test and log them in teardown. I am running the tests in parallel so I need...

Python: Running sequential and parallel tests at once

I recently extended the scope of one of the functions of my python module so that it can be executed sequentially or in parallel (with mpi4py). def foo(param, use_mpi=False): pass When I run...

Coverage - PermissionError: [Errno 1] Operation not permitted

I using pytest and coverage modules for test cases and code coverage. From the project root, I'm able to execute pytest -v but not pytest -v --cov=./ (stack trace below) I set PYTHONPATH to the...

How can I resolve an error running pytest in parallel via xdist in bitbucket pipelines

We execute our unit tests for our python repo within a bitbucket pipeline. Recently we started using the pytest-xdist (https://pypi.org/project/pytest-xdist/) package and successfully run our unit...

Github Actions stays stuck on a task and finally fail on timeout

For the ruptures python package, we are using Github Actions to run our tests on each PR that should be merged on master. It worked beautifully up until now. But since few days, this Gh Actions...

Django Pytest parallel run - Database does not exist

I am using pytest to run my django tests and was trying to speed them up by running them in parallel. I tried modifying my database name using the enviroment variable PYTEST_XDIST_WORKER but my...

Append pytest coverage to file in Gitlab CI artifacts

I am trying to split my pytests in a gitlab stage to reduce the time it takes to run them. However, I am having difficulties getting the full coverage report. I am unable to use pytest-xdist or...