Commit b25c34ea authored by Niels Thykier's avatar Niels Thykier

Convert test suite to use pytest

The dbtests have not been converted (as I could not get them to run
with or without pytest).
Signed-off-by: default avatarNiels Thykier <niels@thykier.net>
parent 0431ec77
[run]
branch = True
omit =
*_boot*.py
*/lib/python*/*
*/dist-packages/*
*/tests/*
*.pyc
*~
.coverage
cover/
web/epydoc/
web/d-i
web/deferred.html
......
......@@ -7,6 +7,7 @@ Build-Depends: python-all-dev,
python-debianbts,
python-ldap,
python-psycopg2,
python-pytest,
python-rrdtool,
python-sqlalchemy (<< 1.0),
python-yaml
......
......@@ -5,5 +5,5 @@
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
tests/test_all.py
pytest -v
endif
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
def suite():
suite = unittest.TestSuite()
for _, _, files in os.walk('.'):
for name in filter(is_test, files):
tests = unittest.defaultTestLoader.loadTestsFromName(name[:-3])
suite.addTests(tests)
return suite
def is_test(filename):
return filename.startswith('test_') and filename.endswith('.py')
if __name__ == "__main__":
unittest.main(defaultTest="suite")
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -7,7 +7,7 @@ from daklib.dakmultiprocessing import DakProcessPool, \
PROC_STATUS_EXCEPTION, PROC_STATUS_SIGNALRAISED
import signal
def test_function(num, num2):
def async_function(num, num2):
from os import kill, getpid
if num == 1:
......@@ -34,7 +34,7 @@ class DakProcessPoolTestCase(DakTestCase):
p = DakProcessPool()
for s in range(3):
for j in range(4):
p.apply_async(test_function, [s, j])
p.apply_async(async_function, [s, j])
p.close()
p.join()
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment