Add test for README and docstring
issue4779 review7181002
This commit is contained in:
1 parent
ecc0dd5fbe
commit
811fa68d1e
2 files changed
+23
-3
No files matched your search
@@ -3,6 +3,17 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import doctest
|
||||
|
||||
import proteus
|
||||
import proteus.config
|
||||
|
||||
os.environ.setdefault('TRYTOND_DATABASE_URI', 'sqlite://')
|
||||
os.environ.setdefault('DB_NAME', ':memory:')
|
||||
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
readme = os.path.normpath(os.path.join(here, '..', '..', 'README'))
|
||||
|
||||
|
||||
def test_suite():
|
||||
@@ -14,6 +25,18 @@ def test_suite():
|
||||
__import__(modname)
|
||||
module = sys.modules[modname]
|
||||
suite.addTests(loader.loadTestsFromModule(module))
|
||||
additional_tests(suite)
|
||||
return suite
|
||||
|
||||
|
||||
def additional_tests(suite):
|
||||
for mod in (proteus, proteus.config):
|
||||
suite.addTest(doctest.DocTestSuite(mod))
|
||||
if os.path.isfile(readme):
|
||||
suite.addTest(doctest.DocFileSuite(readme, module_relative=False,
|
||||
setUp=doctest_setup, tearDown=doctest_teardown,
|
||||
encoding='utf-8',
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||
return suite
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
os.environ.setdefault('TRYTOND_DATABASE_URI', 'sqlite://')
|
||||
os.environ.setdefault('DB_NAME', ':memory:')
|
||||
from trytond.tests.test_tryton import db_exist, create_db
|
||||
|
||||
from proteus import config
|
||||
|
||||
Reference in new issue
Block a user