Testtube uses [watchdog](https://github.com/gorakhargosh/watchdog/) to monitora given path for file changes. It could fairly be described as a simpler(read: easier to use) implementation of watchdog's included "watchmedo"utility.

## Installation

Install testtube like you'd install any other python package:

pip install testtube

## Usage

### Configure testtube

The simplest way to configure testtube is to drop a tube.py file in whateverdirectory you'll be running `stir` from. The only thing that needs to bein that file is a list of tuples named `PATTERNS` consisting of a regularexpression and a list of tests to run.

Here's an example:

from testtube.helpers import pep8_all, pyflakes_all, nosetests_all

PATTERNS = ( (r'.*\.py', [pep8_all, pyflakes_all, nosetests_all]), )

Given the configuration above, testtube will match the full path to thechanged file against `r'.*\.py'`. If it matches, it will then run thefollowing tests: `pep8_all`, `pyflakes_all`, `nosetests_all`.

Testtube comes with a number of helpers, which you can find in[helpers.py](https://github.com/thomasw/testtube/blob/master/testtube/helpers.py)They are designed to save you from writing your own tests as muchas possible. If they don't meet your needs, see the "Writing your own tests"section below.

### Stir it

> stir testtube is now watching /Path/to/CWD/ for changes...

By default, stir will watch your current working directory and configureitself with a settings module named `tube` (tube.py). If you dropped a tube.pyfile into your project root, then you shouldn't need to specify any parametersassuming you execute stir from that directory. If you've customized things abit, `stir -h` will light the way:

usage: stir [-h] [--src_dir SRC_DIR] [--settings SETTINGS]

Watch a directory and run a custom set of tests whenever a file changes.

optional arguments: -h, --help show this help message and exit --src_dir SRC_DIR The directory to watch for changes. (Defaults to CWD) --settings SETTINGS The testtube settings module that defines which tests to run. (Defaults to "tube" - the settings module must be importable from your current working directory)

### Writing your own testsIf the included helpers don't do what you need, you can write your own testsright in your settings module. Simply define a callable that accepts at leastone argument and add it to your patterns list: