-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Hello,
for reference I'm using
pytest: 8.3.3
pytest-odoo: 2.1.1
I have encountered a problem with pytest-odoo using the same environment variables for database connection configuration as the Odoo container (HOST, PORT, USER, PASSWORD)
see code:
Lines 80 to 82 in f602202
| for arg in ['HOST', 'PORT', 'USER', 'PASSWORD']: | |
| if os.environ.get(arg): | |
| options.append('--db_%s=%s' % (arg.lower(), os.environ.get(arg))) |
The USER environment variable is often set to the current username on POSIX systems and this causes a bit of an issue when running pytest-odoo in such an environent. Even when a odoo.conf with the database user exists pytest-odoo passes the --db_user argument to Odoo which seems to override the values in the odoo.conf.
In my opinion this is rather annoying behavior in general and in combination with an IDE where in some cases environment variables may be annoying or hard to control is quite bad.
Generally it doesn't seem like a great idea to use environment variables like USER for anything like this, and they should be prefixed with something, for example ODOO_.
Can we either
- add a prefix to said environment variables, say
ODOO_(although this would likely break their original intended purpose as they won't "just work" in the Odoo container anymore) - allow this feature to be turned either on or off with a flag, possibly defaulting to on as that would not result in any breaking changes
Thanks in advance!