Refactor the test infrastructure to have a single test runner. Important for CI

This commit is contained in:
Sharoon Thomas 2012-02-13 18:06:49 -05:00
parent 9f3aaae931
commit ca8ae863dd
6 changed files with 16 additions and 14 deletions

View File

@ -24,4 +24,3 @@ from .helpers import flash, get_flashed_messages, jsonify, url_for, \
from .application import Nereid, Request, Response, cache
from .session import Session

View File

View File

View File

@ -27,11 +27,17 @@ requires = [
'minimock',
]
package_dir = {
'nereid': 'nereid'
'nereid': 'nereid',
'nereid.contrib': 'nereid/contrib',
'nereid.contrib.testing': 'nereid/contrib/testing'
}
package_data = {}
entry_points = ''
packages = ['nereid',]
packages = [
'nereid',
'nereid.contrib',
'nereid.contrib.testing',
]
if TRYTON_INSTALLED:

View File

@ -13,7 +13,7 @@
"""
import unittest2
from nereid.testing import FailFastTextTestRunner
from xmlrunner import XMLTestRunner
from nereid.contrib.testing import xmlrunner
try:
@ -21,21 +21,18 @@ try:
TRYTON_INSTALLED = True
except ImportError:
TRYTON_INSTALLED = False
else:
from trytond.config import CONFIG
CONFIG.options['db_type'] = 'sqlite'
CONFIG.options['data_path'] = '/tmp/temp_tryton_data/'
from trytond.modules import register_classes
register_classes()
# Test Suite into which all tests are collected
suite = unittest2.TestSuite()
# Begin loading tests
if TRYTON_INSTALLED:
# First load a configuration to do the test
from trytond.config import CONFIG
CONFIG.parse()
# Now load all modules
from trytond.modules import register_classes
register_classes()
# Run this specific test suite
from trytond.modules.nereid.tests import suite as _suite
suite.addTests([_suite()])
@ -43,5 +40,5 @@ if TRYTON_INSTALLED:
if __name__ == '__main__':
with open('result.xml', 'wb') as stream:
XMLTestRunner(stream).run(suite)
xmlrunner.XMLTestRunner(stream).run(suite)