API

destral.openerp

destral.openerp.DEFAULT_USER = 1

Default user id

class destral.openerp.OpenERPService(**kwargs)[source]

OpenERP Service.

create_database(template=True)[source]

Creates a new database.

Parameters:template – use a template (name must be base) (default True)
db_name

Database name.

drop_database()[source]

Drop database from self.db_name

install_module(module)[source]

Installs a module

Parameters:module – Module to install
destral.openerp.patched_pool_jobs(*args, **kwargs)[source]

Patch pool jobs

destral.patch

class destral.patch.PatchNewCursors[source]

Util to patch creation of new cursor.

This will always return the cursor created by Transaction

class destral.patch.PatchedConnection(connection, cursor)[source]

Patched connection wapper to return the same cursor.

This is useful when some method inside a testing mehtod creates new cursors.

Parameters:
  • connection – Original connection
  • cursor – Original cursor
cursor(serialized=False)[source]

Wrapped function to return the same cursor

destral.testing

class destral.testing.OOTestCase(methodName='runTest')[source]

Base class to inherit test cases from for OpenERP Testing Framework.

database

Database used in the test.

require_demo_data = False

Require demo data to run the tests.

destral.testing.get_spec_suite(module)[source]

Get spec suite to run Mamba :param module: Module to get the spec suite :return: suite

destral.testing.get_unittest_suite(module, tests=None)[source]

Get the unittest suit for a module

destral.testing.run_spec_suite(suite)[source]

Run Spec suite :param suite: mamba Runner :return:

destral.testing.run_unittest_suite(suite)[source]

Run test suite

destral.transaction

class destral.transaction.Singleton(mcs, name, bases, dict_)[source]

Metaclass for singleton pattern.

Copyright:Tryton Project
class destral.transaction.Transaction[source]

Transaction object

get_context()[source]

Loads the context of the current user

start(database_name, user=1, context=None)[source]

Start a new transaction

Parameters:
  • database_name – Database name
  • user – User id
  • context – Context to be used
stop()[source]

Stop the transaction.

destral.utils

destral.utils.update_config(config, **kwargs)[source]

Updates config dictionary from keyword arguments.

destral.utils.detect_module(path)[source]

Detect if a path is part of a openerp module or not

Parameters:path – to examine
Returns:None if is not a module or the module name
destral.utils.module_exists(module)[source]

Check if a python module exists.

This is used to check if a module have its own tests defined, Eg: addons.module_name.tests

Parameters:module – Module name to check
Returns:True if exists or False if not
destral.utils.get_dependencies(module, addons_path=None, deps=None)[source]

Get all the dependencies of a module without database

Using __terp__.py files and is used to check requirements.txt in the dependencies.

Parameters:
  • module – Module to find the dependencies
  • addons_path – Path to find the modules
Returns:

a listt of dependencies.

destral.utils.find_files(diff)[source]

Return all the files implicated in a diff

destral.utils.install_requirements(module, addons_path)[source]

Install module requirements and its dependecies

destral.cover