Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
executable file 93 lines (63 sloc) 2.42 KB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Testing with Nose
This test runner uses Nose for test discovery and running. It uses the argument
spec of Nose, but with some options pre-set. To begin with, make sure you have
Nose installed, e.g.:
$ sudo easy_install nose
For daily test runs, use:
$ ./
If you supply attributes, the default ones defined in ``DEFAULT_ATTRS`` will be
ignored. So to run e.g. all tests marked ``slowtest`` or ``non_standard_dep``,
$ ./ -a slowtest,non_standard_dep
See <> for furher details. An excellent
article is also available at <>.
Note that this is just a convenience script. You can use ``nosetests`` directly
if it's on $PATH, with the difference that you have to supply the options
pre-set here manually.
If ```` is placed in $PYTHONPATH, it can be used to create coverage
information (using the built-in coverage plugin of Nose) if the default
option "--with-coverage" is supplied (which also enables some additional
coverage options).
See <> for details.
# '--with-EARL',
DEFAULT_ATTRS = [] # ['!known_issue', '!sparql']
DEFAULT_DIRS = ['test', 'rdflib']
if __name__ == '__main__':
from sys import argv, exit, stderr
try: import nose
except ImportError:
print >>stderr, """\
Requires Nose. Try:
$ sudo easy_install nose
Exiting. """; exit(1)
if '--with-coverage' in argv:
try: import coverage
except ImportError:
print >>stderr, "No coverage module found, skipping code coverage."
if True not in [a.startswith('-a') or a.startswith('--attr=') for a in argv]:
argv.append('--attr=' + ','.join(DEFAULT_ATTRS))
if not [a for a in argv[1:] if not a.startswith('-')]:
argv += DEFAULT_DIRS # since nose doesn't look here by default..
finalArgs = argv + NOSE_ARGS
print "Running nose with:", " ".join(finalArgs[1:])
Jump to Line
Something went wrong with that request. Please try again.