Skip to content

Conversation

@theverygaming
Copy link

I added a flag --odoo-disable-docker-env that allows disabling the HOST PORT USER and PASSWORD environment variables added in #57 as they may conflict with environment variables in some development setups (mainly USER is extremely common to be set)

If there are any improvements needed for this to get merged, please do tell - I'd love to see this issue fixed as currently it makes pytest-odoo unusable without patches for me with my setup...

closes: #81

Copy link
Contributor

@petrus-v petrus-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm not using this feature as well and could effectively create unexpected behaviour if those env names are set which are very common name...

I would love to see PYTEST-ODOO-DB- prefix but this would breaks existing workflow. I believes your solution seems fine.

Maybe we could add a deprecation warning in the same time that suggest to move to the new environ names (with suggest prefix) in the current version and prepare next major release that remove support for those env names

@simahawk what's your call on this ?

@florentx
Copy link
Contributor

If there are any improvements needed for this to get merged, please do tell - I'd love to see this issue fixed as currently it makes pytest-odoo unusable without patches for me with my setup...

I would suggest as an alternative, to nullify environment variable in the line which executes pytest.
Something like:

$ USER=  pytest -s --odoo-database=test --odoo-log-level=debug_sql

@theverygaming
Copy link
Author

I would suggest as an alternative, to nullify environment variable in the line which executes pytest.

Consider that it's not always easily possible to do that, especially with IDEs!
Also especially since the environment variable USER is extremely common, and commonly used.. This may cause other issues!

Also according to POSIX...

It is unwise to conflict with certain variables that are frequently exported by widely used command interpreters and applications

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html

@petrus-v
Copy link
Contributor

@unki2aut as you implement #57 your input could be interesting, how much it would breaks your workflow if we change variables names ?

@rvalyi
Copy link

rvalyi commented Jul 21, 2025

just to let you know this issue just caught me, indeed my USER env var was set. not sure if this PR is a best option but I think the issue will block many people. Eventually we could have a try/except telling it took user from USER in case of database connection failure and suggest to set USER or use this new --odoo-disable-docker-env option.

@jhuber-de
Copy link

I stumbled upon this exact issue, anything I could contribute to help you all getting this merged?

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

Successfully merging this pull request may close these issues.

USER environment variable issues

5 participants