1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2025-10-30 11:09:03 +01:00

New way to run test via loader & conf

This commit is contained in:
Yann 2016-06-15 12:01:11 +02:00
commit a3b3102604
6 changed files with 18 additions and 6 deletions

View file

@ -7,6 +7,7 @@ import sys, os
LODEL2_LIB_ABS_PATH = None
if LODEL2_LIB_ABS_PATH is not None:
sys.path.append(os.path.dirname(LODEL2_LIB_ABS_PATH))
sys.path.append(os.path.dirname(LODEL2_LIB_ABS_PATH))
try:
import lodel
@ -36,6 +37,16 @@ def start():
if __name__ == '__main__':
start()
if Settings.runtest:
import unittest
import tests
loader = unittest.TestLoader()
suite = loader.discover('tests')
runner = unittest.TextTestRunner()
runner.run(suite)
exit()
LodelHook.call_hook('lodel2_loader_main', '__main__', None)
#Run interative python
import code

View file

@ -308,6 +308,8 @@ LODEL2_CONF_SPECS = {
SettingValidator('strip')),
'lib_path': ( None,
SettingValidator('path')),
'runtest': ( True,
SettingValidator('bool')),
},
'lodel2.logging.*' : {
'level': ( 'ERROR',

View file

@ -53,6 +53,8 @@ cp -R examples $testdir
cp -R tests $testdir
cd $testdir
rm -R conf.d && mv tests/tests_conf.d conf.d
python3 -W ignore -m unittest $@
make
#python3 -W ignore -m unittest $@
python3 loader.py
rm -Rf $testdir

View file

@ -1,4 +0,0 @@
try:
import loader
except ImportError:
print("This tests are designed to be runned with the runtest utility")

View file

@ -3,7 +3,7 @@ from unittest import mock
from unittest.mock import patch
import tests.loader_utils
from tests.leapi.query.utils import dyncode_module as dyncode
import leapi_dyncode as dyncode
from lodel.leapi.leobject import LeObject
from lodel.leapi.query import LeDeleteQuery, LeUpdateQuery, LeGetQuery, \

View file

@ -3,6 +3,7 @@ debug = False
sitename = noname
plugins_path = /foo/plugins
plugins = dummy, dummy_datasource
runtest=True
[lodel2.logging.stderr]
level = Error