Remove __main__ entry point and PATH manipulation in test

This commit is contained in:
Guillem Barba 2014-06-04 11:03:57 +02:00
parent e1a042080e
commit 6ce5686bbd
1 changed files with 4 additions and 14 deletions

View File

@ -1,21 +1,13 @@
#!/usr/bin/env python
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
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 datetime
import unittest
from decimal import Decimal
from dateutil.relativedelta import relativedelta
import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT, test_view,\
test_depends
from trytond.tests.test_tryton import (POOL, DB_NAME, USER, CONTEXT, test_view,
test_depends)
from trytond.exceptions import UserError
from trytond.transaction import Transaction
@ -101,7 +93,8 @@ class TestCase(unittest.TestCase):
'''
with Transaction().start(DB_NAME, USER, context=CONTEXT):
company, = self.company.search([
('party.name', '=', 'Dunder Mifflin')])
('party.name', '=', 'Dunder Mifflin'),
])
currency = company.currency
self.user.write([self.user(USER)], {
'main_company': company.id,
@ -218,6 +211,3 @@ def suite():
suite.addTest(test)
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase))
return suite
if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())