Git Product home page Git Product logo

pytest-timeouts's Introduction

pytest-timeouts

Build Status codecov Documentation Status PyPI pyversion Supported pytest 3|4 Downloads PyPI - License GitHub Release Date

Linux-only Pytest plugin to control durations of various test case execution phases.

Documentation

For documentation visit pytest-timeouts.readthedocs.io.

About

This plugin has been designed for specific use cases which are out of the scope of famous pytest-timeout plugin. It uses a SIGALRM signal to schedule a timer which breaks the test case.

Features

  • setup, execution and teardown phase timeouts controllable by:
    • opts: --setup-timeout, --execution-timeout and --teardown-timeout
    • ini: setup_timeout, execution_timeout and teardown_timeout
    • mark: setup_timeout, execution_timeout and teardown_timeout
  • fixed order of timeout settings: opts > markers > ini, controlled by --timeouts-order
  • --timeouts-order allow change order of override timeout settings, and disable some settings, i.e. --timeout-order i disable markers and opts, any combination is allow
  • timeout disabled when debugging with PDB

Installation

Stable

pip install pytest-timeouts

Master

pip install git+https://github.com/Scony/pytest-timeouts.git

Usage

Command line

pytest --setup-timeout 2.5 --execution-timeout 2.01  --teardown-timeout 0

pytest.ini setting

[pytest]
setup_timeout = 2.5
execution_timeout = 2.01
teardown_timeout = 0

Mark

import time

import pytest


@pytest.mark.setup_timeout(0.3)
@pytest.mark.execution_timeout(0.5)
@pytest.mark.teardown_timeout(0.4)
def test_timeout():
    time.sleep(1)

Contributors

  • Pawel Lampe
  • Kamil Luczak

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.