polishmatt / sputr

An intuitive interface for Python's unit testing framework

Home Page:https://pypi.python.org/pypi/sputr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sputr

Build Status

Simple Python Unit Test Runner

An intuitive command line and Python package interface for Python's unit testing framework with consistent behavior across Python versions.

Command Line Examples

Run all tests in the current directory

sputr

Run all tests in the specified directory

sputr dirname

Run all tests in files that match the specified name

sputr filename.py

Run all tests in a specific file

sputr dirname/filename.py

Run all tests that match a pattern

* may be used as a wildcard.

sputr test_name

sputr test_name_*

Python Package Examples

sputr.discover returns a TestSuite.

import sputr
suite = sputr.discover(start_dir='.', pattern='test_*')
unittest.TextTestRunner().run(suite)

sputr.list_tests converts a TestSuite to a list of TestCase objects which can be iterated over easily.

for test in sputr.list_tests(suite):
    print test.id()

Breaking Changes

1.1.0

  • Removed --python option (issue #3)
  • Exit code 1 returned when no tests are run (issue #4)

About

An intuitive interface for Python's unit testing framework

https://pypi.python.org/pypi/sputr

License:MIT License


Languages

Language:Python 100.0%