RichGuk / noseagain

Autonose automatically runs tests for nose (http://code.google.com/p/python-nose/) when the code in the working directory is saved.

noseagain / README
100644 42 lines (28 sloc) 2.543 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Noseagain automatically runs tests for nose (http://code.google.com/p/python-nose/) when the code in the working directory changes, i.e. is saved. Noseagain can run every test whenever any file is saved or try and be selective and only run test files that have the same filename (with test_ prefix) as the module being saved.
 
== Installation
$ sudo python setup.py install
 
== Basic usage
After installing you can use the noseagain script. By default noseagain will search for test files using the following structure:
 
- root
    - tests
        - test_module.py
        - test_module2.py
    - module.py
    - random_folder
        - module2.py
 
So for each python file that is not prefixed with test_ it will attempt to locate a related file in the tests folder and run that. This means that by default it will be selective as to which tests are run. For example, if you only save the module.py file then test_module.py is run and not all the tests in the tests folder. You can of course override this by using the -a option.
 
To run noseagain simply run this command from the root of the project:
 
$ noseagain
 
If you want to pass extra options to nose itself, for example on OS X you might have the growl notification plugin, you can simply do:
 
$ noseagain -- --with-growl
 
Please note that noseagain scans all the python files located in the root and sub-directories of root on load. If you want to have the files re-scanned, for example if you have added new tests or modules then attempt to interrupt the script with Ctrl+C once, after 1 second it will re-scan the files. If you want to quit the script then simply Ctrl+C twice in a row.
 
Options
==============
 
-w WORKING_DIR, --working-dir=WORKING_DIR
    This option allows you to run noseagain from a different location to the project but still set the project root as the working directory. By default the working directory is worked out from which ever directory the script is run from.
    
-t TEST_DIR, --test-dir=TEST_DIR
    This option allows you to override the directory the tests are stored in. By default it looks for tests in a folder called 'tests'. This option only works when using the selective test running, this option becomes redundant when used with -a, --all-tests.
 
-a, --all-tests
    This options allows you to override the default selective nature of the tests that are run. It will simply run all the tests each time any file is saved.
 
-c, --clear
    This option will clear the shell before running any tests (using cls on Windows and clear on *nix).