-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
[FIX] contract unittest test_contract.py #876
Conversation
89e0807
to
2c1c061
Compare
2c1c061
to
14bf20e
Compare
@mt-software-de What is your problem exactly ? Here under the logs from the last 14.0 branch (coa module is well loaded before tests): |
@rousseldenis As you can see in my log So if i am installing it with --test-tags at_install |
The good way is to initialize the db with all dependencies, then launch the tests If you check logs, that's how it is done everywhere on OCA. So, no need to change how specific modules tests are launched |
I have an testing environment where it is more like the odoo standard why Like you can see for example in odoo core modules |
The good flow is to install all base modules and base dependencies (Odoo core and needed OCA ones) first with no tests (we don't want to test modules that have already been tested. On that first step, coa module is installed. Then, launch the tests of this repos modules. This flow has not to be changed and tests results are successful. |
My opinion in that case is, that the tests should be tagged as post_install, because they are (like you have described it) executed as post_install tests. |
So, why all modules in OCA are not tested with 'post-install' tag? I think you misunderstand the test flow.
On the Odoo runbot instance, modules are installed with --test-enable. So, when a module is loaded, tests are run immediately. Except for modules tagged post_install (for the reasons you evoked).
We install normally all external modules of the repository. Then, we load repository modules with --test-enable. The difference with Odoo is that all core modules are already installed when we run tests. So, we don't need, in most cases, to tag with post_install our modules. But, you can for sure use the test flow you want on your side, not on OCA. |
Odoo does it like me first install modules with --test-tags -post_install which means only test tagged as at_install But one thing here again l10n_us and l10n_generic_coa is not a dependency of contract |
That's because, as I said, you test it without having installed based modules before (and coa module is loaded at the end). If you want to understand tests flows here, you can read the logs from the 14.0 branch for instance: https://github.com/OCA/contract/actions/runs/2983787607/jobs/4783850871 You can see there is first an install: Then, tests are run: You remark that only the modules of the repository are concerned: |
I understand how the oca executes the tests. |
You want to say two modules that are not aware of each others (no dependency) ? |
Yes or one which has only one dependency which is a module of the repo, this could maybe overwrite a method which changes the test results of the parent module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope.
@rousseldenis Is it affecting testing on OCA? If not, it does not look wrong to tag it properly like the modules on odoo standard |
Why doing this if it is not necessary ? Tests are going well for this module. |
I find it legit to have the module tests succeed when you install it on its own like @mt-software-de explained. I think that what lot of devs are doing when testing locally a module. |
How you proceed here, to come to a conclusion? |
post-install tag does not do that! Look at the test log. post-install will run tests after all modules loaded. That's not the default behaviour and it's unwanted here as not necessary. There is no mean to run a module on its own apart doing a new test job only for that module.
Of course they do, but you can currently test contract module on its own locally without changing anything. @mt-software-de IMHO, if you have a specific test flow, you should adapt your tests to take that into account, not here. |
@rousseldenis i have no specific test flow This leads to a not successful test run. Because of missing account.journal entries. In your case or better in the oca test environment it is only working because At first there is the install the of account and some other modules Then there is the installation of contract module with the test-enable flag. IMHO: The test should be properly tagged because if you installing this module when there is no module already installed (except base) the test should run successful. And in the case of contract module this could not happen. |
That's the thing I'm explaining from the beginning! On OCA, the test flow is to install all dependency modules, THEN launching the tests. So, except for some modules and when it's justified, post-install should not be used. If you wnat to test it locally, you must respect that flow. |
The easiest commands to test a module on its own :
This works without changing anything. |
Of course this works because And then afterwords you run the tests
The tests will fail. |
And what is refrain you in that flow ? |
Why do you do that ? |
|
As I said, the test flow is like that on OCA, on every repository. You should test like I exposed before. |
I still don't quite understand why it is a wrong to tag the tests properly. |
Because that tag introduces a different behaviour. It's not 'wrong' but you are changing the way tests are run. This is not needed for that module particularly. And what is not necessary is not needed. |
Ok. I think it is needed, because if we test it without any pre installed module it will not work. So tagging it properly is necessary. |
Who ? |
We with our Development Team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussion, this change is acceptable.
This PR has the |
/ocabot merge patch |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 2045d24. Thanks a lot for contributing to OCA. ❤️ |
This unittest needs the installation of l10n_us and l10n_generic_coa
otherwise there are no account.journal
the install of the two modules happens in the account module with a post_init_hook