跳至内容
菜单
此问题已终结
1 回复
3890 查看

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?

形象
丢弃
最佳答案

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)


形象
丢弃
相关帖文 回复 查看 活动
1
7月 25
2196
2
7月 25
7700
2
7月 25
4115
2
7月 25
3866
2
6月 25
2474