Giter VIP home page Giter VIP logo

stestr's Introduction

stestr

Build status Appveyor build status Code coverage Latest Version

You can see the full rendered docs at: http://stestr.readthedocs.io/en/latest/

Overview

stestr is parallel Python test runner designed to execute unittest test suites using multiple processes to split up execution of a test suite. It also will store a history of all test runs to help in debugging failures and optimizing the scheduler to improve speed. To accomplish this goal it uses the subunit protocol to facilitate streaming and storing results from multiple workers.

stestr originally started as a fork of the testrepository project. But, instead of being an interface for any test runner that used subunit, like testrepository, stestr concentrated on being a dedicated test runner for python projects. While stestr was originally forked from testrepository it is not backwards compatible with testrepository. At a high level the basic concepts of operation are shared between the two projects but the actual usage is not exactly the same.

Installing stestr

stestr is available via pypi, so all you need to do is run:

pip install -U stestr

to get stestr on your system. If you need to use a development version of stestr you can clone the repo and install it locally with:

git clone https://github.com/mtreinish/stestr.git && pip install -e stestr

which will install stestr in your python environment in editable mode for local development

Using stestr

After you install stestr to use it to run tests is pretty straightforward. The first thing you'll want to do is create a .stestr.conf file for your project. This file is used to tell stestr where to find tests and basic information about how tests are run. A basic minimal example of the contents of this is:

[DEFAULT]
test_path=./project_source_dir/tests

which just tells stestr the relative path for the directory to use for test discovery. This is the same as --start-directory in the standard unittest discovery.

After this file is created you should be all set to start using stestr to run tests. To run tests just use:

stestr run

it will first create a results repository at .stestr/ in the current working directory and then execute all the tests found by test discovery. If you're just running a single test (or module) and want to avoid the overhead of doing test discovery you can use the --no-discover/-n option to specify that test.

For all the details on these commands and more thorough explanation of options see the stestr manual: https://stestr.readthedocs.io/en/latest/MANUAL.html

Migrating from testrepository

If you have a project that is already using testrepository stestr's source repo contains a helper script for migrating your repo to use stestr. This script just creates a .stestr.conf file from a .testr.conf file. (assuming it uses a standard subunit.run test command format) To run this from your project repo just call:

$STESTR_SOURCE_DIR/tools/testr_to_stestr.py

and you'll have a .stestr.conf created.

Building a manpage

The stestr manual has been formatted so that it renders well as html and as a manpage. The html output and is autogenerated and published to: https://stestr.readthedocs.io/en/latest/MANUAL.html but the manpage has to be generated by hand. To do this you have to manually run sphinx-build with the manpage builder. This has been automated in a small script that should be run from the root of the stestr repository:

tools/build_manpage.sh

which will generate the troff file in doc/build/man/stestr.1 which is ready to be packaged and or put in your system's man pages.

stestr's People

Contributors

mtreinish avatar rbtcollins avatar masayukig avatar afrittoli avatar jml avatar frankban avatar bz2 avatar tosky avatar cmsj avatar jelmer avatar emonty avatar toabctl avatar alexei-kornienko avatar chkumar246 avatar cdent avatar claudiubelu avatar javacruft avatar stmcginnis avatar ssbarnea avatar zaneb avatar

Watchers

Sergey Vilgelm avatar James Cloos 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.