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
Easy access to ORM Environment? #19
Comments
Can you tell me more about your usage of pytest-odoo? Do you run "pytest" tests with it? The use case the lib tries to cover now is to run the tests built in odoo addons which are using python's unittest, but with the comfort of the pytest CLI. These odoo's unittest tests classes already include all the boilerplate to open a cursor, environment and so on. I do prefer a lot pytest tests over unittest, but we solely use the latter inside Odoo addons because they can also be run by the odoo machinery ( Thinking about it, there is probably a way to run pytest tests from a unittest class, which would allow to write tests as pytest but make them available from So I'm looking forward to discussing your usage :) |
We used to use unittest in Odoo addons. But now we prefer pytest. We will use pytest in all our Odoo modules and convert existing unittest code to pytest. I think pure pytest is better. Running pytest inside a unittest class will blur simplicity and easiness of pytest. The another reason for shifting to pytest from unittest is that we are implementing BDD in Odoo development. pytest supports BDD through pytest-bdd and Odoo supports pytest through pytest-odoo. |
@erkesado Would you mind on giving an example of how you want to use it? |
IMHO to write pytest tests for your own addons. |
First of all, thanks for a great pytest plugin.
I wonder if there is an easy way to access to ORM Environment like self.env['res.users'] ....
I have searched in pytest_odoo.py file. But I can't find anything related to the access of ORM Environment.
If it does not have an easy way of accessing ORM Environment right, I guess it should be right in the pytest-odoo. It is mindless to develop an another pytest plugin. It is mindless to copy/paste in every module.
If there is no such thing yet, I am eager to help doing it in the pytest-odoo.
The text was updated successfully, but these errors were encountered: