diff --git a/tests/__init__.py b/tests/__init__.py index a48c78d..69c2cc9 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,26 +3,9 @@ tests/__init__.py :copyright: (c) 2014 by Openlabs Technologies & Consulting (P) Limited + :copyright: (C) 2016 by NaN·tic Projectes de programari lliure :license: BSD, see LICENSE for more details. """ -import unittest +from .test_party_merge import suite -import trytond.tests.test_tryton - -from tests.test_views_depends import TestViewsDepends -from tests.test_party import TestParty - - -def suite(): - """ - Define suite - """ - test_suite = trytond.tests.test_tryton.suite() - test_suite.addTests([ - unittest.TestLoader().loadTestsFromTestCase(TestViewsDepends), - unittest.TestLoader().loadTestsFromTestCase(TestParty), - ]) - return test_suite - -if __name__ == '__main__': - unittest.TextTestRunner(verbosity=2).run(suite()) +__all__ = ['suite'] diff --git a/tests/test_party.py b/tests/test_party_merge.py similarity index 57% rename from tests/test_party.py rename to tests/test_party_merge.py index 970bc1c..8a1b900 100644 --- a/tests/test_party.py +++ b/tests/test_party_merge.py @@ -3,45 +3,26 @@ tests/test_party.py :copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited + :copyright: (C) 2016 by NaN·tic Projectes de programari lliure :license: BSD, see LICENSE for more details. """ -import sys -import os -DIR = os.path.abspath(os.path.normpath(os.path.join( - __file__, '..', '..', '..', '..', '..', 'trytond' -))) -if os.path.isdir(DIR): - sys.path.insert(0, os.path.dirname(DIR)) +from trytond.tests.test_tryton import ModuleTestCase +from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT +import trytond.tests.test_tryton +from trytond.transaction import Transaction import unittest -if 'DB_NAME' not in os.environ: - from trytond.config import CONFIG - CONFIG['db_type'] = 'sqlite' - os.environ['DB_NAME'] = ':memory:' -from trytond.tests.test_tryton import POOL, USER -from trytond.tests.test_tryton import DB_NAME, CONTEXT -from trytond.transaction import Transaction -import trytond.tests.test_tryton - - -class TestParty(unittest.TestCase): - ''' - Test Party - ''' +class PartyMergeTestCase(ModuleTestCase): + 'Test Party' + module = 'party_merge' def setUp(self): - """ - Set up data used in the tests. - this method is called before each test function execution. - """ - trytond.tests.test_tryton.install_module('party_merge') - + super(PartyMergeTestCase, self).setUp() self.Party = POOL.get('party.party') def test0005_merge_parties(self): - """Test party merge function. - """ + 'Test party merge function' with Transaction().start(DB_NAME, USER, context=CONTEXT): party1, party2, party3 = self.Party.create([{ 'name': 'Party 1', @@ -74,14 +55,7 @@ class TestParty(unittest.TestCase): def suite(): - """ - Define suite - """ - test_suite = trytond.tests.test_tryton.suite() - test_suite.addTests( - unittest.TestLoader().loadTestsFromTestCase(TestParty) - ) - return test_suite - -if __name__ == '__main__': - unittest.TextTestRunner(verbosity=2).run(suite()) + suite = trytond.tests.test_tryton.suite() + suite.addTests(unittest.TestLoader().loadTestsFromTestCase( + PartyMergeTestCase)) + return suite diff --git a/tests/test_views_depends.py b/tests/test_views_depends.py deleted file mode 100644 index 3c49cc9..0000000 --- a/tests/test_views_depends.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -""" - tests/test_views_depends.py - - :copyright: (C) 2014 by Openlabs Technologies & Consulting (P) Limited - :license: BSD, see LICENSE for more details. -""" -import sys -import os -DIR = os.path.abspath(os.path.normpath(os.path.join( - __file__, '..', '..', '..', '..', '..', 'trytond' -))) -if os.path.isdir(DIR): - sys.path.insert(0, os.path.dirname(DIR)) -import unittest - -import trytond.tests.test_tryton -from trytond.tests.test_tryton import test_view, test_depends - - -class TestViewsDepends(unittest.TestCase): - ''' - Test views and depends - ''' - - def setUp(self): - """ - Set up data used in the tests. - this method is called before each test function execution. - """ - trytond.tests.test_tryton.install_module('party_merge') - - def test0005views(self): - ''' - Test views. - ''' - test_view('party_merge') - - def test0006depends(self): - ''' - Test depends. - ''' - test_depends() - - -def suite(): - """ - Define suite - """ - test_suite = trytond.tests.test_tryton.suite() - test_suite.addTests( - unittest.TestLoader().loadTestsFromTestCase(TestViewsDepends) - ) - return test_suite - -if __name__ == '__main__': - unittest.TextTestRunner(verbosity=2).run(suite()) diff --git a/tryton.cfg b/tryton.cfg index 0211c21..e964ec6 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=3.2.1.0 +version=3.8.0 depends: party xml: