LEFT | RIGHT |
(no file at all) | |
| 1 #!/usr/bin/env python |
| 2 #This file is part of Tryton. The COPYRIGHT file at the top level of |
| 3 #this repository contains the full copyright notices and license terms. |
| 4 import sys |
| 5 import os |
| 6 import unittest |
| 7 import doctest |
| 8 |
| 9 DIR = os.path.abspath(os.path.normpath(os.path.join(__file__, |
| 10 '..', '..', '..', '..', '..', 'trytond'))) |
| 11 if os.path.isdir(DIR): |
| 12 sys.path.insert(0, os.path.dirname(DIR)) |
| 13 |
| 14 import trytond.tests.test_tryton |
| 15 from trytond.tests.test_tryton import test_view, test_depends |
| 16 from trytond.backend.sqlite.database import Database as SQLiteDatabase |
| 17 |
| 18 |
| 19 class ProductionTestCase(unittest.TestCase): |
| 20 ''' |
| 21 Test Production module. |
| 22 ''' |
| 23 |
| 24 def setUp(self): |
| 25 trytond.tests.test_tryton.install_module('production') |
| 26 |
| 27 def test0005views(self): |
| 28 ''' |
| 29 Test views. |
| 30 ''' |
| 31 test_view('production') |
| 32 |
| 33 def test0006depends(self): |
| 34 ''' |
| 35 Test depends. |
| 36 ''' |
| 37 test_depends() |
| 38 |
| 39 |
| 40 def doctest_dropdb(test): |
| 41 ''' |
| 42 Remove sqlite memory database |
| 43 ''' |
| 44 database = SQLiteDatabase().connect() |
| 45 cursor = database.cursor(autocommit=True) |
| 46 try: |
| 47 database.drop(cursor, ':memory:') |
| 48 cursor.commit() |
| 49 finally: |
| 50 cursor.close() |
| 51 |
| 52 |
| 53 def suite(): |
| 54 suite = trytond.tests.test_tryton.suite() |
| 55 suite.addTests(unittest.TestLoader().loadTestsFromTestCase( |
| 56 ProductionTestCase)) |
| 57 suite.addTests(doctest.DocFileSuite('scenario_production.rst', |
| 58 setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8', |
| 59 optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) |
| 60 return suite |
| 61 |
| 62 if __name__ == '__main__': |
| 63 unittest.TextTestRunner(verbosity=2).run(suite()) |
LEFT | RIGHT |