This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This distribution is intended to provide testing tools and especially unit test base classes to enhance those that come builtin with OpenERP (version >= 7)

Currently, it features these base test classes:

How to install

in general, all you need is to make anybox.testing.openerp importable from the python executable that is to run the tests.

Users of the Buildout recipe just have to add anybox.testing.openerp to their lists of eggs, preferably in a buildout configuration intended for developers:

[buildout]
extends = buildout.cfg

[openerp]
eggs += anybox.testing.openerp

(assuming of course that the part installing OpenERP is named openerp)

SharedSetupTransactionCase

from anybox.testing.openerp import SharedSetupTransactionCase

This class allows to mutualize at the test class level test data preparations, so that it does not have to be executed again and again. It relies internally on PostgreSQL savepoints to do so.

The simplest usage is to load some XML files:

class MyTestCase(SharedSetupTransactionCase):

    _data_files = ('employees.xml',
                   'products.xml')

    _module_ns = 'tests'

Paths are relative to the directory holding the test python modules (typically tests) ; _module_ns is meant to specify in which (existing or not) OpenERP module’s namespace the data is to be inserted. This is necessary, e.g., for cross-referencing in one2many values.

You may also subclass the initTestData class method to insert your own preparations:

@classmethod
def initTestData(cls):
    # if you need them XML data files:
    super(MyTestCase, cls).initTestData()
    cls.initLotsOfStuff()

Finally, this class comes equipped with the utility and assertion methods.

TransactionCase

from anybox.testing.openerp import TransactionCase

This is a simple subclass of openerp.tests.common.TransactionCase featuring:

  • the utility and assertion methods

  • (in Python >= 2.7 context only) a more robust tearDown that protects against exceptions during setUp.

    Such exceptions have been witnessed to cause PostgreSQL to deadlock, which is a major source of developper headaches and of loss of time.

Utility and assertion methods

Both TransactionCase and SharedSetupTransactionCase feature additional helper methods. These are

  • assertRecord()
  • searchUnique()
  • readUnique()
  • assertUniqueWithValues()

They allow for more direct writing and more readability. Check the docstrings for more details. This documentation should get Sphinxed soon.

Why a separate package

We (Anybox) are very open to direct inclusion in OpenERP core, and are ready to submit this as a proper merge request (hence involving a bit more of our own resources than has already been done).

That being said, the reasons for a separate package are:

  • we don’t want to depend on actual inclusion in the core for our projects
  • we need this to be available in v7 branch (current stable)
  • we might want or need to stay ahead of whichever inclusions can occur in the future ; using a published version is more convenient for us than keeping track in our private VCSes.

Why not an addon ?

Do you really want to see a module for unit testing to appear in your modules list ?

Authors

  • Georges Racinet (@gracinet on identi.ca & twitter), Anybox SAS, http://anybox.fr, GPG: 0x33AB0A35 on public key servers.

Contributing

We are very open to contributions. Don’t hesitate to fork and issue pull requests on the BitBucket repository

Changes

1.3.1 (2014-01-31)

  • #2: robustness of assertRecord if read(cr, uid, id) returns a list.

1.3 (2013-12-26)

  • added a new assertUniqueWithValues() utility, combining searchUnique() with assertRecord to save even more hassle.

1.2 (2013-11-07)

  • added a new assertNoRecord(model, domain) utility

1.1 (2012-08-05)

  • added utility and assertion methods
  • corrected documentation

1.0 (2012-07-13)

  • initial release
Release History

Release History

1.3.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.3.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.3dev

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
anybox.testing.openerp-1.3.1.tar.gz (8.4 kB) Copy SHA256 Checksum SHA256 Source Jan 31, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting