Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USER environment variable issues #81

Open
theverygaming opened this issue Nov 7, 2024 · 0 comments
Open

USER environment variable issues #81

theverygaming opened this issue Nov 7, 2024 · 0 comments

Comments

@theverygaming
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant