[MERGE] Sync with trunk
bzr revid: odo@openerp.com-20121031154418-lfx7sywca2v2mcei
This commit is contained in:
commit
ec7b097036
|
@ -87,9 +87,9 @@ In addition to the above possibilities, when invoked with a non-existing module
|
|||
sub-modules.
|
||||
|
||||
Depending on the unittest2_ class that is used to write the tests (see
|
||||
``openerp.tests.common`` for some helper classes that you can re-use), a database
|
||||
may be created before the test is run, and the module providing the test will
|
||||
be installed on that database.
|
||||
:mod:`openerp.tests.common` for some helper classes that you can re-use), a
|
||||
database may be created before the test is run, and the module providing the
|
||||
test will be installed on that database.
|
||||
|
||||
Because creating a database, installing modules, and then dropping it is
|
||||
expensive, it is possible to interleave the run of the ``fast_suite`` tests
|
||||
|
@ -98,3 +98,20 @@ each requested module is installed, its fast_suite tests are run. The database
|
|||
is thus created and dropped (and the modules installed) only once.
|
||||
|
||||
.. _unittest2: http://pypi.python.org/pypi/unittest2
|
||||
|
||||
TestCase subclasses
|
||||
-------------------
|
||||
|
||||
.. automodule:: openerp.tests.common
|
||||
:members:
|
||||
|
||||
.. note::
|
||||
|
||||
The `setUp` and `tearDown` methods are not part of the tests. Uncaught
|
||||
exceptions in those methods are errors, not test failures. In particular,
|
||||
a failing `setUp` will not be followed by a `tearDown` causing any
|
||||
allocated resource in the `setUp` to not be released by the `tearDown`.
|
||||
|
||||
In the :py:class:`openerp.tests.common.TransactionCase` and
|
||||
:py:class:`openerp.tests.common.SingleTransactionCase`, this means the
|
||||
test suite can hang because of unclosed cursors.
|
||||
|
|
|
@ -101,6 +101,7 @@ def preload_registry(dbname):
|
|||
def run_test_file(dbname, test_file):
|
||||
""" Preload a registry, possibly run a test file, and start the cron."""
|
||||
try:
|
||||
config = openerp.tools.config
|
||||
db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
|
||||
cr = db.cursor()
|
||||
_logger.info('loading test file %s', test_file)
|
||||
|
|
|
@ -1548,7 +1548,6 @@ class BaseModel(object):
|
|||
)
|
||||
self._invalids.update(fields)
|
||||
if error_msgs:
|
||||
cr.rollback()
|
||||
raise except_orm('ValidateError', '\n'.join(error_msgs))
|
||||
else:
|
||||
self._invalids.clear()
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
The module :mod:`openerp.tests.common` provides a few helpers and classes to write
|
||||
tests.
|
||||
"""
|
||||
import threading
|
||||
import time
|
||||
import unittest2
|
||||
|
@ -115,8 +119,8 @@ class RpcCase(unittest2.TestCase):
|
|||
Subclass of TestCase with a few XML-RPC proxies.
|
||||
"""
|
||||
|
||||
def __init__(self, name):
|
||||
super(RpcCase, self).__init__(name)
|
||||
def __init__(self, methodName='runTest'):
|
||||
super(RpcCase, self).__init__(methodName)
|
||||
|
||||
class A(object):
|
||||
pass
|
||||
|
|
|
@ -286,8 +286,11 @@ class YamlInterpreter(object):
|
|||
model = self.get_model(record.model)
|
||||
|
||||
view_id = record.view
|
||||
if view_id and (view_id is not True):
|
||||
view_id = self.pool.get('ir.model.data').get_object_reference(self.cr, SUPERUSER_ID, self.module, record.view)[1]
|
||||
if view_id and (view_id is not True) and isinstance(view_id, basestring):
|
||||
module = self.module
|
||||
if '.' in view_id:
|
||||
module, view_id = view_id.split('.',1)
|
||||
view_id = self.pool.get('ir.model.data').get_object_reference(self.cr, SUPERUSER_ID, module, view_id)[1]
|
||||
|
||||
if model.is_transient():
|
||||
record_dict=self.create_osv_memory_record(record, fields)
|
||||
|
|
|
@ -109,6 +109,8 @@ def assert_constructor(loader, node):
|
|||
|
||||
def record_constructor(loader, node):
|
||||
kwargs = loader.construct_mapping(node)
|
||||
assert "model" in kwargs, "'model' argument is required for !record"
|
||||
assert "id" in kwargs, "'id' argument is required for !record"
|
||||
return Record(**kwargs)
|
||||
|
||||
def python_constructor(loader, node):
|
||||
|
|
Loading…
Reference in New Issue