Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
3895 Visninger

I want to run coverage test for my odoo module in docker, but I get the error. 

first I run coverage test with command in docker :

coverage run /usr/bin/odoo -d odoo --db_host=db --db_user=odoo --db_password=odoo --stop-after-init --test-enable --init "My Library"


and the result :

Traceback (most recent call last):

    file "/usr/bin/odoo", line 5, in <module>

        import odoo

impostError: No module named odoo



what I should do?

Avatar
Kassér
Bedste svar

Hello,

You need to add odoo path on environment variables.

  1. Locate the directory containing Odoo, e.g., /path/to/odoo.

  2. Add the Odoo directory to the PYTHONPATH environment variable by running the following command:

    PYTHONPATH=$PYTHONPATH:/path/to/odoo
    

    Replace /path/to/odoo with the actual path to the Odoo directory on your system.

  3. To make this change permanent, add the command above to your shell profile file (.bashrc, .bash_profile, or .zshrc, depending on the shell you use). Open the profile file with a text editor, add the command at the end of the file, and save the changes.


Or you can use Pycharm with "env"

Configure a Python interpreter | PyCharm Documentation (jetbrains.com)


Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
jul. 25
2215
2
jul. 25
7708
2
jul. 25
4127
2
jul. 25
3878
2
jun. 25
2489