[Skip to content](#main)

[→](/)

[![Avunu](/brand/avunu-logo.svg)![Avunu](/brand/avunu-logo-light.svg)](/)[Services](/services/)[Consulting](/services/consulting/)[ERP](/services/erp/)[Odoo](/services/erp/odoo/)[ERPNext](/services/erp/erpnext/)[Custom software](/services/custom-software/)[Devices & IoT](/services/devices-iot/)[Websites](/services/websites/)[Infrastructure](/services/infrastructure/)[Partners](/partners/)

[Work](/work/)[Open source](/open-source/)[Knowledge base](/kb/)[About](/about/)

[About Avunu](/about/)[Team](/about/team/)[Insights](/insights/)[Contact](/contact/)

[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

- [Services](/services/)[Consulting](/services/consulting/)
- [ERP](/services/erp/)
- [Odoo](/services/erp/odoo/)
- [ERPNext](/services/erp/erpnext/)
- [Custom software](/services/custom-software/)
- [Devices & IoT](/services/devices-iot/)
- [Websites](/services/websites/)
- [Infrastructure](/services/infrastructure/)
- [Partners](/partners/)

[Work](/work/)[Open source](/open-source/)[Knowledge base](/kb/)[About](/about/)

- [About Avunu](/about/)
- [Team](/about/team/)
- [Insights](/insights/)
- [Contact](/contact/)

[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

[Knowledge base](/kb/)[Odoo](/kb/odoo/)Test custom Odoo modules from the command line

Search the knowledge basePress/

ESC

Jump to

[Browse the knowledge base](/kb/)[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[Odoo](/kb/odoo/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

↵select↑↓navigateescclose

Search the knowledge base

[Skip to the article](#kb-article)[Odoo](/kb/odoo/)7 articles

- [Overview](/kb/odoo/)
- [A repair shop workflow on Odoo 18, from inspection to invoice](/kb/odoo/repair-shop-workflow-on-odoo/)
- [Importing documents from email into Odoo](/kb/odoo/importing-documents-from-email-into-odoo/)
- [Migrating from QuickBooks to Odoo with a clean cutover](/kb/odoo/migrating-from-quickbooks-to-odoo/)
- [Odoo Community and OCA overview](/kb/odoo/odoo-community-and-oca-overview/)
- [Set up and work in an Odoo 18 development environment with odoo-nix](/kb/odoo/odoo-development-environment/)
- [Set up two-way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)
- [Test custom Odoo modules from the command line](/kb/odoo/testing-custom-odoo-modules/)

Other sections[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

In Odoo: 7 articles

[Overview](/kb/odoo/)[A repair shop workflow on Odoo 18, from inspection to invoice](/kb/odoo/repair-shop-workflow-on-odoo/)[Importing documents from email into Odoo](/kb/odoo/importing-documents-from-email-into-odoo/)[Migrating from QuickBooks to Odoo with a clean cutover](/kb/odoo/migrating-from-quickbooks-to-odoo/)[Odoo Community and OCA overview](/kb/odoo/odoo-community-and-oca-overview/)[Set up and work in an Odoo 18 development environment with odoo-nix](/kb/odoo/odoo-development-environment/)[Set up two-way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)[Test custom Odoo modules from the command line](/kb/odoo/testing-custom-odoo-modules/)

Other sections[Frappe](/kb/frappe/)[ERPNext](/kb/erpnext/)[WordPress](/kb/wordpress/)[NixOS](/kb/nixos/)[Email](/kb/email/)[Linux](/kb/linux/)[Databases](/kb/databases/)[Containers](/kb/containers/)[Proxmox](/kb/proxmox/)[Git & Dev Tools](/kb/git-and-dev-tools/)

OdooTest custom Odoo modules from the command line

Install a custom Odoo module on a scratch database, run only its tests, avoid port clashes with a dev server, and write tests that keep passing after upgrades.

UpdatedNov 7, 2026

Applies toOdoo 18.0

Tagsodootestingpythonmodules

Reading time10 min

On this page[Run a module's tests](#run-a-modules-tests)[Narrow the run while you work](#narrow-the-run-while-you-work)[Run the whole standard suite of an updated module](#run-the-whole-standard-suite-of-an-updated-module)[Avoid port clashes with a dev server](#avoid-port-clashes-with-a-dev-server)[Turn off a dev mail catcher](#turn-off-a-dev-mail-catcher)[Install freezegun](#install-freezegun)[Run tests with odoo-nix](#run-tests-with-odoo-nix)[Write tests that survive upgrades](#write-tests-that-survive-upgrades)[Tag every test class with a phase](#tag-every-test-class-with-a-phase)[Make sure plain tests are collected](#make-sure-plain-tests-are-collected)[Keep tests off the network](#keep-tests-off-the-network)[Reuse core test bases and check what they need](#reuse-core-test-bases-and-check-what-they-need)[Test what the server will not tell you](#test-what-the-server-will-not-tell-you)[Compare against a frozen reference when refactoring](#compare-against-a-frozen-reference-when-refactoring)[Checklist before you push](#checklist-before-you-push)[Related documents](#related-documents)

This document shows how to run the tests of a custom Odoo module with `odoo-bin`, how to keep the run from colliding with a dev server, and how to write tests that survive upgrades. Use it when you add or change a module and want to prove it installs and behaves before it reaches a real database.

The examples come from Avunu's public Odoo addon repositories, such as [mail-addons](https://github.com/Avunu/mail-addons), [edi-addons](https://github.com/Avunu/edi-addons), [timesheet-addons](https://github.com/Avunu/timesheet-addons) and [web-addons](https://github.com/Avunu/web-addons), which target Odoo 18.0. The commands assume an Odoo checkout with an `odoo.conf` next to it, as in those modules' READMEs. If you use odoo-nix, see [Run tests with odoo-nix](#run-tests-with-odoo-nix).

## Run a module's tests

Use a scratch database, install the module into it, run the tests, and exit:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_D</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">B</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-i</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-enable</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-tags</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">/</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

Each option does one job:

`-d <TEST_DB>` names the database. Use a throwaway one, never a database with data you care about.

`-i <MODULE_NAME>` installs the module (and its dependencies) on that database. Installation is what triggers the tests.

`--test-enable` turns the test runner on.

`--test-tags /<MODULE_NAME>` limits the run to tests that belong to that module. Without it you also run the standard tests of every module that gets installed along the way.

`--stop-after-init` makes Odoo exit when loading and testing finish, instead of staying up as a server.

Several modules in one run work the same way. Give `-i` a comma-separated list and give `--test-tags` a comma-separated list of `/module` entries:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_D</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">B</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-i</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_ON</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">,</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_TW</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">O</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-enable</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-tags</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">/</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_ON</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">,/</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_TW</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">O</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

Note

In Odoo 18, setting `--test-tags` also enables tests, so `--test-enable` is redundant when you pass tags. We keep both because it makes the intent obvious in a pasted command.

### Narrow the run while you work

The tag spec has the form `[-][tag][/module][:class][.method]`, and the options help in Odoo 18 shows the same grammar. Use it to re-run one class or one method while you iterate:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_D</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">B</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-u</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-tags</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">/</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">:</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_CLAS</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">S</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">.</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_METHO</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">D</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

Here `-u` updates a module that is already installed on the database, which is faster than creating a new database each time. A leading `-` excludes matching tests instead of including them.

### Run the whole standard suite of an updated module

You can also skip `--test-tags` and use only `--test-enable` with an update. The `web_theme_carbon` module documents this for its cascade tests:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">odoo</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-u</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">web_theme_carbon</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-enable</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

With only `--test-enable`, Odoo runs every test tagged `standard` in the modules being installed or updated, with no filter by module. An update also covers the installed modules that depend on the one you named, so their tests run too.

## Avoid port clashes with a dev server

A test run still starts Odoo's HTTP machinery, and tests built on `HttpCase` make real requests to it. If your dev server is already listening on the default ports, the test process cannot bind them.

Give the test run its own ports:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_D</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">B</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-i</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-enable</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-tags</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">/</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--http-port</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">8098</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--gevent-port</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">8097</span>
```

The defaults are `8069` for `--http-port` and `8072` for `--gevent-port`. The values `8098` and `8097` are the ones we use; any free pair works.

### Turn off a dev mail catcher

Some dev environments run a server-wide mail catcher that intercepts every outgoing message. That breaks tests that assert on what was sent. In the odoo-nix dev shell we use, the `mail_cloudflare` module's README turns it off for the run with an environment variable:

```
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">ODOO_MAILCATCH_ENABLED</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">0</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">python</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo/odoo-bin</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo.conf</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-d</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">TEST_D</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">B</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">\</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">  </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-i</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">mail_cloudflare</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-enable</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--test-tags</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">/mail_cloudflare</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--stop-after-init</span>
```

That variable belongs to that dev environment. If your setup uses a different catcher, turn it off its own way before testing mail code.

## Install freezegun

Odoo's test framework imports `freezegun`, and Odoo 18 uses it for time-frozen tests. Our development setup treats it as required to run any Odoo test.

This catches people out with `uv`. Odoo lists `freezegun` only under `tests_require`, which `uv` does not install. We list it explicitly in `pyproject.toml` in the dev dependency group so it is always present:

```
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">[</span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">dependency-groups</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">]</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">dev = [</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"debugpy"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"ruff"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"watchdog"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"freezegun"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"websocket-client"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">]</span>
```

If a run fails with `ModuleNotFoundError: No module named 'freezegun'`, add the package to the environment. Do not remove it from the project later because nothing in your own tests imports it.

## Run tests with odoo-nix

In an [odoo-nix](https://github.com/Avunu/odoo-nix) project or addon repository, the `odoo` command wraps these runs:

```
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">odoo</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">test</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E"><</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">MODULE_NAM</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">E</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">></span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> [<TEST_DB>]   </span><span style="--shiki-dark:#8B949E;--shiki-light:#6E7781"># update the module (-u) and run its tests</span>
<span style="--shiki-dark:#FFA657;--shiki-light:#953800">odoo</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">test</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--all</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--fresh-db</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">            </span><span style="--shiki-dark:#8B949E;--shiki-light:#6E7781"># install every addon of the repository into a throwaway database and test them all</span>
```

`odoo test` refuses to run when Odoo would skip browser tours (no headless browser, or no `websocket-client`), because Odoo reports a skipped tour as a pass. `--fresh-db` creates a database named `odoo_nix_test_<pid>` and drops it when the run ends, unless you add `--keep-db`. `--all` leaves out the addons the repository lists under `[[tool.odoo-nix.untested]]`.

Avunu's addon repositories use odoo-nix's repository standards, and their CI runs one test gate. Run it locally exactly as CI does:

```
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">ODOO_NIX_CI</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">1</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">nix</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">develop</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">--no-pure-eval</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">-c</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">odoo-nix</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">gate</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">test</span>
```

The gate tests every installable addon on a fresh database with coverage, then scans Odoo's log with `checklog-odoo`, so a warning or error logged during the run fails it even when every test passed. It also checks the coverage floor, which can only rise, and the addons' licenses and development status. See [CI](https://docs.avunu.net/odoo-nix/docs/standards/ci/) in the odoo-nix documentation.

## Write tests that survive upgrades

Most failed test runs after an upgrade come from three causes: a wrong test phase, a test class that never gets collected, and tests that depend on things you do not control. Handle each one when you write the test.

### Tag every test class with a phase

Odoo gives test classes the `standard` and `at_install` tags by default. `at_install` tests run right after your module installs, while the registry is only partly loaded. `post_install` tests run after every module has loaded.

Our modules tag nearly every test class like this:

```
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">from</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> odoo.tests </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">import</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> TransactionCase, tagged</span>

<span style="--shiki-dark:#D2A8FF;--shiki-light:#8250DF">@tagged</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"post_install"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">, </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"-at_install"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">)</span>
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">class</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">TestMyFeature</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(</span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">TransactionCase</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">):</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#D2A8FF;--shiki-light:#8250DF">@</span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">classmethod</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">def</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#D2A8FF;--shiki-light:#8250DF">setUpClass</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(cls):</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">        </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">super</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">().setUpClass()</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">        </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">cls</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.partner </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">cls</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.env[</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"res.partner"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">].create({</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"name"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">: </span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"Test Partner"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">})</span>

<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">def</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#D2A8FF;--shiki-light:#8250DF">test_partner_is_created</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(self):</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">        </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">self</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.assertTrue(</span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">self</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.partner.id)</span>
```

The `-at_install` part removes the default tag, so the class runs in exactly one phase. Odoo logs a warning for a class that is neither or both.

Why this matters for upgrades: a module may load before modules that add fields or constraints to the models it touches. Two examples from our repositories:

`base_import_pdf_by_template_engine` loads before `account`. On a database with `account` installed, `res.partner` gets a NOT NULL column whose ORM default is not attached yet mid-load. An `at_install` test that creates a partner through `BaseCommon` fails with a `NotNullViolation` before it reaches the module's own code.

`hr_timesheet_time_control_systray` creates projects in its tests. A project touches fields owned by modules that load after it, so the registry has to be complete first.

When a test creates records on shared models such as partners or projects, use `post_install`.

### Make sure plain tests are collected

If a test needs no database, it is tempting to subclass `unittest.TestCase`. Under `--test-tags`, that class is silently skipped, with no warning. Odoo's tag filter only runs tests that have a `test_tags` attribute, and only Odoo's own base classes assign it.

Use `BaseCase` for pure-Python tests instead. This is how `import_via_xberg` tests its helper functions:

```
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">from</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> odoo.tests.common </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">import</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> BaseCase</span>

<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">class</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">TestTransposeTableCells</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(</span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">BaseCase</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">):</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">def</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#D2A8FF;--shiki-light:#8250DF">test_header_row_and_data_rows_split_correctly</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">(self):</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">        </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">...</span>
```

After you add a new test file, run with `--test-tags` and confirm the count of tests moved. A class that collects zero tests looks exactly like a passing run.

Also remember to import each new test file in `tests/__init__.py`, as every module in our repositories does:

```
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">from</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> . </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">import</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> test_cloudflare_api</span>
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">from</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> . </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">import</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> test_ir_mail_server</span>
```

### Keep tests off the network

Tests that call out to a real service break when the service changes, and they leak data. Mock the boundary instead.

The `mail_cloudflare` module ships a small harness in `tests/common.py`. Its `MockCloudflareCase.mock_cloudflare()` context manager patches the HTTP session so no request leaves the machine, records every request in `self.cf_requests`, and serves scripted responses:

```
<span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">with</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">self</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.mock_cloudflare():</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    mail.send()</span>
```

For smaller cases, `unittest.mock.patch` on the single function that talks to the outside world is enough. Both approaches keep the suite fast and deterministic.

Warning

The `mail_cloudflare` mock patches `current_test` to `False`, because Odoo's mail sending short-circuits in test mode. For that reason you must not call `url_open` from an `HttpCase` inside that context manager. Keep HTTP calls outside the `with` block.

### Reuse core test bases and check what they need

Build on Odoo's own bases, such as `TransactionCase` and `MailCommon`, rather than reimplementing setup. Odoo maintains them across releases. Our `CloudflareCommon` class extends `MailCommon` and adds one extra mail server.

When a base needs more than you expect, say so in the test. For example, `HttpCase` has to really log in, and a module that enforces password rules (in our case `password_security`) rejects the default password `new_test_user` uses. Our UI test passes an explicit strong password, a throwaway value that exists only in the test database (never reuse a real one):

```
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">user </span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328"> new_test_user(</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#79C0FF;--shiki-light:#0550AE">self</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">.env,</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">login</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"systray_tech_ui"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">,</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">password</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"<STRONG_TEST_PASSWORD>"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">,</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">    </span><span style="--shiki-dark:#FFA657;--shiki-light:#953800">groups</span><span style="--shiki-dark:#FF7B72;--shiki-light:#CF222E">=</span><span style="--shiki-dark:#A5D6FF;--shiki-light:#0A3069">"base.group_user,hr_timesheet.group_hr_timesheet_user,project.group_project_user"</span><span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">,</span>
<span style="--shiki-dark:#E6EDF3;--shiki-light:#1F2328">)</span>
```

### Test what the server will not tell you

A broken import path, a QWeb template that does not parse, or a missing SCSS variable does not stop the server from starting. The page just comes out empty. That is why `hr_timesheet_time_control_systray` has a `test_timer_systray_ui.py` that runs the real navbar in a browser, and why `web_theme_carbon` has `tests/test_cascade.py`, which inspects the compiled asset bundles to confirm the module's CSS wins over Odoo's `!important` rules.

If your module ships JavaScript, templates or styles, add at least one test of that kind.

### Compare against a frozen reference when refactoring

When you change behavior you inherit from upstream, keep the old implementation inside the test as a reference and assert the new one matches it. `base_import_pdf_by_template_engine` does this with a frozen copy of the upstream function in `test_table_info_data.py`. When the upstream code changes in a later release, the comparison tells you what moved.

## Checklist before you push

The module installs on a fresh scratch database with `-i`.

`--test-tags /<MODULE_NAME>` runs the number of tests you expect, not zero.

Every class is tagged for exactly one phase, and DB-free classes use `BaseCase`.

No test reaches the network.

`freezegun` is in the environment's dev dependencies.

Ports are overridden if a dev server is running.

In an odoo-nix repository, `odoo-nix gate test` passes, which also means the log has no warnings.

## Related documents

[Odoo Development Environment](/kb/odoo/odoo-development-environment/)

[Odoo Community and OCA Overview](/kb/odoo/odoo-community-and-oca-overview/)

[Importing Documents from Email into Odoo](/kb/odoo/importing-documents-from-email-into-odoo/)

[Two-Way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)

Sources

- [github.com/Avunu/mail-addons/tree/18.0/mail_cloudflare/tests](https://github.com/Avunu/mail-addons/tree/18.0/mail_cloudflare/tests)
- [github.com/Avunu/edi-addons](https://github.com/Avunu/edi-addons)
- [docs.avunu.net/odoo-nix/docs/standards/ci](https://docs.avunu.net/odoo-nix/docs/standards/ci/)

Need help with Odoo?

Our notes can take you a long way, but sometimes you'd rather have someone who's done it before.

[Odoo implementation](/services/erp/odoo/)

[← PreviousSet up two-way SMS in Odoo with Twilio](/kb/odoo/two-way-sms-in-odoo-with-twilio/)

CC0This article is in the public domain ([CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/)), code samples included. Use it however helps you.

On this page

- [Run a module's tests](#run-a-modules-tests)
- [Narrow the run while you work](#narrow-the-run-while-you-work)
- [Run the whole standard suite of an updated module](#run-the-whole-standard-suite-of-an-updated-module)
- [Avoid port clashes with a dev server](#avoid-port-clashes-with-a-dev-server)
- [Turn off a dev mail catcher](#turn-off-a-dev-mail-catcher)
- [Install freezegun](#install-freezegun)
- [Run tests with odoo-nix](#run-tests-with-odoo-nix)
- [Write tests that survive upgrades](#write-tests-that-survive-upgrades)
- [Tag every test class with a phase](#tag-every-test-class-with-a-phase)
- [Make sure plain tests are collected](#make-sure-plain-tests-are-collected)
- [Keep tests off the network](#keep-tests-off-the-network)
- [Reuse core test bases and check what they need](#reuse-core-test-bases-and-check-what-they-need)
- [Test what the server will not tell you](#test-what-the-server-will-not-tell-you)
- [Compare against a frozen reference when refactoring](#compare-against-a-frozen-reference-when-refactoring)
- [Checklist before you push](#checklist-before-you-push)
- [Related documents](#related-documents)

[Back to top↑](#top)

Services

- [ERP implementation](/services/erp/)
- [Odoo](/services/erp/odoo/)
- [ERPNext](/services/erp/erpnext/)
- [Custom software](/services/custom-software/)
- [Devices & IoT](/services/devices-iot/)
- [Websites](/services/websites/)
- [Infrastructure](/services/infrastructure/)

Resources

- [Our work](/work/)
- [Open source](/open-source/)
- [Knowledge base](/kb/)
- [Insights](/insights/)

Company

- [About](/about/)
- [Team](/about/team/)
- [Partners](/partners/)
- [Contact](/contact/)

Clients

- [Project portal](https://erp.avunu.net/projects)
- [Invoices](https://erp.avunu.net/)
- [Support](https://erp.avunu.net/)

[![Avunu](/brand/avunu-logo-light.svg)](/)[\<av-icon data-jx-static>\<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" stroke="none" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\<path d="M20.400 20.500h-3.600v-5.600c0-1.300 0-3-1.800-3s-2.100 1.400-2.100 2.900v5.700H9.400V9h3.400v1.600c.5-.9 1.600-1.900 3.400-1.900 3.600 0 4.300 2.400 4.300 5.500v6.300zM5.300 7.400a2.100 2.100 0 1 1 0-4.100 2.100 2.100 0 0 1 0 4.100zm1.800 13.100H3.600V9h3.500v11.500zM22.200 0H1.800C.8 0 0 .8 0 1.700v20.600c0 .9.800 1.700 1.800 1.700h20.400c1 0 1.800-.8 1.800-1.700V1.700C24 .8 23.200 0 22.200 0z">\</path>\</svg>\</av-icon>](https://www.linkedin.com/company/avunu)[\<av-icon data-jx-static>\<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" stroke="none" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">\<path d="M12 .3a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.500 11.500 0 0 1 6 0c2.300-1.500 3.300-1.200 3.300-1.200.6 1.700.2 2.900.1 3.200.8.8 1.200 1.900 1.200 3.200 0 4.600-2.800 5.600-5.500 5.900.4.400.8 1.100.8 2.200v3.300c0 .3.2.7.8.6A12 12 0 0 0 12 .3">\</path>\</svg>\</av-icon>](https://github.com/Avunu)[Client portal](https://erp.avunu.net/projects)[Start a project](/start/)

Avunu LLC · 948 East Philadelphia Street, York, PA 17403 · (717) 814-8540Knowledge base articles are in the public domain[Privacy](/privacy/)[Terms](/terms/)
