run unit tests in parallel

This commit is contained in:
Damien Elmes 2017-10-05 14:14:56 +10:00
parent f7062ff0c6
commit d0929e5bab
4 changed files with 6 additions and 28 deletions

View File

@ -6,6 +6,5 @@ install:
- sudo apt-get install portaudio19-dev
- pip install -r requirements.txt
- pip install nose
- pip install coveralls
script: nosetests ./tests --with-coverage --cover-package=./anki
script: nosetests ./tests --processes=16

View File

@ -9,7 +9,7 @@ from anki import Collection as aopen
newPath = None
newMod = None
def test_create():
def test_create_open():
global newPath, newMod
(fd, path) = tempfile.mkstemp(suffix=".anki2", prefix="test_attachNew")
try:
@ -24,12 +24,11 @@ def test_create():
newMod = deck.mod
del deck
def test_open():
# reopen
deck = aopen(newPath)
assert deck.mod == newMod
deck.close()
def test_openReadOnly():
# non-writeable dir
assertException(Exception,
lambda: aopen("/attachroot.anki2"))

View File

@ -57,47 +57,28 @@ def test_latex():
# turn it on again so other test don't suffer
anki.latex.build = True
def test_bad_latex_command_write18():
# bad commands
(result, msg) = _test_includes_bad_command("\\write18")
assert result, msg
def test_bad_latex_command_readline():
(result, msg) = _test_includes_bad_command("\\readline")
assert result, msg
def test_bad_latex_command_input():
(result, msg) = _test_includes_bad_command("\\input")
assert result, msg
def test_bad_latex_command_include():
(result, msg) = _test_includes_bad_command("\\include")
assert result, msg
def test_bad_latex_command_catcode():
(result, msg) = _test_includes_bad_command("\\catcode")
assert result, msg
def test_bad_latex_command_openout():
(result, msg) = _test_includes_bad_command("\\openout")
assert result, msg
def test_bad_latex_command_write():
(result, msg) = _test_includes_bad_command("\\write")
assert result, msg
def test_bad_latex_command_loop():
(result, msg) = _test_includes_bad_command("\\loop")
assert result, msg
def test_bad_latex_command_def():
(result, msg) = _test_includes_bad_command("\\def")
assert result, msg
def test_bad_latex_command_shipout():
(result, msg) = _test_includes_bad_command("\\shipout")
assert result, msg
def test_good_latex_command_works():
# inserting commands beginning with a bad name should not raise an error
(result, msg) = _test_includes_bad_command("\\defeq")
assert not result, msg
@ -108,7 +89,7 @@ def test_good_latex_command_works():
def _test_includes_bad_command(bad):
d = getEmptyCol()
f = d.newNote()
f['Front'] = '[latex]%s[/latex]' % bad;
f['Front'] = '[latex]%s[/latex]' % bad
d.addNote(f)
q = f.cards()[0].q()
return ("'%s' is not allowed on cards" % bad in q, "Card content: %s" % q)

View File

@ -22,5 +22,4 @@ else
args=""
echo "Call with coverage=1 to run coverage tests"
fi
(cd $dir && nosetests3 -vs $lim $args --cover-package=anki)
(cd $dir && nosetests -vs --processes=16 $lim $args --cover-package=anki)