Skip to content

USER environment variable issues #81

@theverygaming

Description

@theverygaming

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:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions