add flag to disable environment variables#83
Conversation
petrus-v
left a comment
There was a problem hiding this comment.
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 ?
I would suggest as an alternative, to nullify environment variable in the line which executes pytest. $ USER= pytest -s --odoo-database=test --odoo-log-level=debug_sql |
Consider that it's not always easily possible to do that, especially with IDEs! Also according to POSIX...
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html |
|
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. |
|
I stumbled upon this exact issue, anything I could contribute to help you all getting this merged? |
|
I never had this issue. Ideally I would make this the default, and then use like WDYT? |
|
So you propose making it an enable flag instead of a disable flag (as it is now in the PR)? I would be fine with that (I prefer it even^^) Of course that will likely break the setup of the people who implemented this feature in the first place... But it would restore normal behavior as one expects (not using a very common POSIX environment variable for another purpose) I do like the environment variable idea, it allows the user to easily set it in the same place where they also set HOST and friends. We could also do both the environment variable and the command line switch! |
I added a flag
--odoo-disable-docker-envthat allows disabling theHOSTPORTUSERandPASSWORDenvironment variables added in #57 as they may conflict with environment variables in some development setups (mainlyUSERis 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