Skip to main content

Console script to run nose with the good import

Project description

This is an alternative test runner that prevents confusing situations due to the special openerp.addons namespace for Odoo addons.

At the time being, it is meant to be used in conjunction with the buildout recipe only.

Use case

Odoo overrides the python importer for the Odoo addons (also called modules but we’ll avoid this terminology here for confusion with Python modules), to place them into the openerp.addons namespace.

For instance, some foo Odoo addon will be set in the sys.modules as instead of just foo.

The issue is that nose imports the test modules directly, with the effect that they aren’t in the openerp.addons namespace. This leads to overall duplication of the Odoo addon as a Python module, which can in some cases confuse the code. For instance, some isinstance() calls might fail, depending on the execution path.

Notably, this runner is necessary for tests related to the Odoo connector framework. Historically this is the context in which the above mentionned issue arose. Anybox had been using the ordinary nosetests for several years before actually stumbling on this.


This runner relies on the assumption that all relevant Odoo addons have already been imported when the nose importer kicks in. This condition is always true if used through the buildout recipe

Therefore, the standard way of using the runner is to declare it in the buildout configuration:

eggs = anybox.nose.odoo
openerp_scripts = odoo_nosetests=odoo_nosetests command-line-options=-d

and then run, e.g:

bin/odoo_nosetests -d TESTING_DB -- some/module/tests


Copyright (c) 2015 Anybox SAS <> Released under GPLv3+ license

Author:Jean-Sébastien SUZANNE <>

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for anybox.nose.odoo, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size anybox.nose.odoo-0.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page