Skip to content

Commit f5eddea

Browse files
committed
Added
1 parent 3098c17 commit f5eddea

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

run_tests.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Testing with Nose
5+
=================
6+
7+
This test runner uses Nose for test discovery and running. It uses the argument
8+
spec of Nose, but with some options pre-set. To begin with, make sure you have
9+
Nose installed, e.g.:
10+
11+
$ sudo easy_install nose
12+
13+
For daily test runs, use:
14+
15+
$ ./run_tests.py
16+
17+
If you supply attributes, the default ones defined in ``DEFAULT_ATTRS`` will be
18+
ignored. So to run e.g. all tests marked ``slowtest`` or ``non_standard_dep``,
19+
do:
20+
21+
$ ./run_tests.py -a slowtest,non_standard_dep
22+
23+
See <http://code.google.com/p/python-nose/> for furher details. An excellent
24+
article is also available at <http://ivory.idyll.org/articles/nose-intro.html>.
25+
26+
Note that this is just a convenience script. You can use ``nosetests`` directly
27+
if it's on $PATH, with the difference that you have to supply the options
28+
pre-set here manually.
29+
30+
Coverage
31+
========
32+
33+
If ``coverage.py`` is placed in $PYTHONPATH, it can be used to create coverage
34+
information (using the built-in coverage plugin of Nose) if the default
35+
option "--with-coverage" is supplied (which also enables some additional
36+
coverage options).
37+
38+
See <http://nedbatchelder.com/code/modules/coverage.html> for details.
39+
40+
"""
41+
42+
43+
NOSE_ARGS = [
44+
'--where=./',
45+
'--with-doctest',
46+
'--doctest-extension=.doctest',
47+
'--doctest-tests',
48+
# '--with-EARL',
49+
]
50+
51+
COVERAGE_EXTRA_ARGS = [
52+
'--cover-package=rdflib_sqlalchemy',
53+
'--cover-inclusive',
54+
]
55+
56+
DEFAULT_ATTRS = [] # ['!known_issue', '!sparql']
57+
58+
DEFAULT_DIRS = ['test', 'rdflib_sqlalchemy']
59+
60+
61+
if __name__ == '__main__':
62+
63+
from sys import argv, exit, stderr
64+
try: import nose
65+
except ImportError:
66+
print >>stderr, """\
67+
Requires Nose. Try:
68+
69+
$ sudo easy_install nose
70+
71+
Exiting. """; exit(1)
72+
73+
74+
if '--with-coverage' in argv:
75+
try: import coverage
76+
except ImportError:
77+
print >>stderr, "No coverage module found, skipping code coverage."
78+
argv.remove('--with-coverage')
79+
else:
80+
NOSE_ARGS += COVERAGE_EXTRA_ARGS
81+
82+
83+
if True not in [a.startswith('-a') or a.startswith('--attr=') for a in argv]:
84+
argv.append('--attr=' + ','.join(DEFAULT_ATTRS))
85+
86+
if not [a for a in argv[1:] if not a.startswith('-')]:
87+
argv += DEFAULT_DIRS # since nose doesn't look here by default..
88+
89+
90+
finalArgs = argv + NOSE_ARGS
91+
print "Running nose with:", " ".join(finalArgs[1:])
92+
nose.run_exit(argv=finalArgs)

run_tests_py3.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
python3.5 setup.py build
3+
4+
if [ -d build/py3_testing ]; then
5+
rm -r build/py3_testing
6+
echo "Removed py3_testing directory from previous run."
7+
fi
8+
9+
mkdir build/py3_testing
10+
cp -r test build/py3_testing/
11+
cp skiptests.list run_tests.py build/py3_testing/
12+
cp -r build/lib/rdflib build/py3_testing/
13+
14+
cd build/py3_testing
15+
16+
2to3 -wn --no-diffs test
17+
2to3 -wn --no-diffs run_tests.py
18+
19+
python3.5 run_tests.py $@

skiptests.list

Whitespace-only changes.

0 commit comments

Comments
 (0)