GithubHelp home page GithubHelp logo

suederat / pytest-parallel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kevlened/pytest-parallel

0.0 0.0 0.0 96 KB

A pytest plugin for parallel and concurrent testing

License: MIT License

Python 97.95% Shell 2.05%

pytest-parallel's Introduction

pytest-parallel

a pytest plugin for parallel and concurrent testing

What?

This plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).

Why?

pytest-xdist is great to run tests that:

  1. aren't threadsafe
  2. perform poorly when multithreaded
  3. need state isolation

pytest-parallel is better for some use cases (like Selenium tests) that:

  1. can be threadsafe
  2. can use non-blocking IO for http requests to make it performant
  3. manage little or no state in the Python environment

Put simply, pytest-xdist does parallelism while pytest-parallel does parallelism and concurrency.

Requirements

  • Python3 version [3.6+]
  • Unix or Mac for --workers
  • Unix, Mac, or Windows for --tests-per-worker

Installation

pip install pytest-parallel

Options

  • workers (optional) - max workers (aka processes) to start. Can be a positive integer or auto which uses one worker per core. Defaults to 1.
  • tests-per-worker (optional) - max concurrent tests per worker. Can be a positive integer or auto which evenly divides tests among the workers up to 50 concurrent tests. Defaults to 1.

Examples

# runs 2 workers with 1 test per worker at a time
pytest --workers 2

# runs 4 workers (assuming a quad-core machine) with 1 test per worker
pytest --workers auto

# runs 1 worker with 4 tests at a time
pytest --tests-per-worker 4

# runs 1 worker with up to 50 tests at a time
pytest --tests-per-worker auto

# runs 2 workers with up to 50 tests per worker
pytest --workers 2 --tests-per-worker auto

Notice

Beginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.

Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.

Source

License

MIT

pytest-parallel's People

Contributors

blueyed avatar dependabot[bot] avatar etragas-fathom avatar jayvdb avatar kevlened avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.