Closed mathisgauthey closed 4 months ago
I did a pip install -e .
inside my Odoo source directory.
I also downgraded pytest to pip install pytest==7.4.4
because there's an issue with pytest > 8 apparently.
But it can't find my custom addons correctly. Is there any way to help him find it ?
Here is my workspace organization :
Alright, I managed to make the commandline work by adding pytest -s PATH_TO_TEST_FILE --odoo-database=odoo-db --odoo-config=config/odoo.conf
And this is my odoo.conf
:
[options]
addons_path = src/odoo/odoo/addons,src/odoo/addons,addons/odoo-api-rest,addons/odoo-firebase-push-notification,addons/ouktuva-odoo-addons
db_host = localhost
db_port = 5432
dbfilter = ^odoo-db$
db_name = odoo-db
db_user = odoo
db_password = odoo
admin_passwd = admin
dev = all
debug_mode = True
But I can't seem to make the VS Code testing extension work.
My settings.json
:
"python.testing.pytestArgs": [
"PATH_TO_TEST_FOLDER",
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}/src/odoo"
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}/src/odoo"
}
Error :
2024-05-17 14:05:48.347 [error] pytest test discovery error for workspace: /home/mat/documents/odoo-dev-env
ModuleNotFoundError: No module named 'odoo.addons.ADDON_NAME'
Is there any way to provide pytest with the addon_path for Odoo to take ? I'm this close to get a fully fledged Odoo WSL dev env that works well enough for any use case I'm facing.
Alright, guess I found out because it now works flawlessly using these settings.json
for VSCODE :
"python.testing.pytestArgs": [
"addons/ADDON_NAME/tests",
"--odoo-database",
"odoo-db",
"--odoo-config",
"config/odoo.conf"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}/src/odoo",
"ODOO_RC": "${workspaceFolder}/config/odoo.conf",
"OPENERP_SERVER": "${workspaceFolder}/config/odoo.conf"
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}/src/odoo",
"ODOO_RC": "${workspaceFolder}/config/odoo.conf",
"OPENERP_SERVER": "${workspaceFolder}/config/odoo.conf"
}
With odoo.conf
being :
[options]
addons_path = COMMA_SEPARATED_ADDONS_PATH_LIST
db_host = localhost
db_port = 5432
dbfilter = ^odoo-db$
db_name = odoo-db
db_user = odoo
db_password = odoo
admin_passwd = admin
dev = all
debug_mode = True
Hey there. Just like #56 and running my odoo-dev-env.
I try the command :
pytest -s --odoo-database=odoo-db
and get the following error :Thansk in advance !