Skip to main content

Nosetests and Odoo

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 openerp.addons.foo 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.

Invocation

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

Credits

Copyright (c) 2015 Anybox SAS <http://anybox.fr> Released under GPLv3+ license

Author:

Jean-Sébastien SUZANNE <jssuzanne@anybox.fr>

Metadata

Release files for anybox.nose.odoo 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anybox.nose.odoo 0.1
File Size Uploaded
anybox.nose.odoo-0.1.tar.gz 3.7 kB Details

Release files / anybox.nose.odoo-0.1.tar.gz

Download URL anybox.nose.odoo-0.1.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
15aa9d89a3e888fc010d287fb734a023a7c5a44d7a1d3d898211bad5c46a6791
BLAKE2b-256 checksum
How to use checksums
eb856fe03074e28b67fe3566debcc5515c273509015e2766fc2e5579cf288ebc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page