camptocamp / pytest-odoo

pytest plugin to run Odoo tests
GNU Affero General Public License v3.0
67 stars 41 forks source link

Filtering test using odoo test tagged - how to avoid running at_install test ? #37

Open petrus-v opened 3 years ago

petrus-v commented 3 years ago

I'd like to skip test class decorated with the "at_install" odoo test tags while running my test using pytest.

Is there already some way to do so without adding extra line in code source ?

It works properly using Skip decorator @pytest.mark.skip(reason="Do not run at install test using pytest"), I was wondering if there are some plan to provide those tags as pytest marker to be able to filter those tests ?

yvaucher commented 3 years ago

Hello @petrus-v ,

Could you elaborate? Pytest doesn't run the tests at_install.

You can refer to @guewen comment in https://github.com/camptocamp/pytest-odoo/issues/26#issuecomment-432535204

The at_install doesn't make much sense with pytest-odoo. You prepare first your database, then execute tests.

Usually what you want is to execute only a selection of tests, like your custom modules. As Odoo source code and OCA are already covered by their respective tests. It could be redundant to run them again locally. You might want a selection of Odoo core tests to validate you don't break anything but you might prefer to copy those tests and extend them as your workflow might have some customization to tests or that breaks odoo core tests.

petrus-v commented 3 years ago

I'm using pytest as development tool.

I've 2 case where I get tests with the at_install

As a developer I want to execute test using pytest, I was wondering if at_install are discoverd as pytest marker to not launch those at_install tests easly ?