-
Notifications
You must be signed in to change notification settings - Fork 23.2k
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] mail: build error 57492 #163035
[FIX] mail: build error 57492 #163035
Conversation
It is currently always a pain to know for sure if a test is running when writing conditional code. - `config['test-tags']` is one of the more reliable, but if starting a server with tests (test-tags, ...) will result in a special state. This is sometime visible when truing to render a report after executing a test, the report will be rendered in html. - module.current_test will only work for at install tests, because it's main purpose was initially to give the module being currently loaded. - module.current_test will only work for at install tests, because it's main purpose was initially to give the module being currently loaded. - threading.testing will only work for the main thread, not the one of a thread serving an http request. The easiest solution is to have a global flag that will always be thruthy when executing a test, no mater if it is at install or post install. The current_test flag is actually the closest one that could cover all cases. It just need to be thruthy when running a post install test. The main reason this flag contains the currently loading module is to fill the _init_modules in some cases, but this shouldn't be useful if the module is already in the _init_modules list This is actually the case since odoo#53499, and some of the hack regarding _init_modules and current_test can be removed. This will allow to recycle this flag to make it True when in test mode, False otherwise.
It looks like even with the registry check, we can still have rare case were the websocket request arrives after registry test mode is removed. This fixed by checking it current test is set This flag is more reliable with the pare,t backported commit.
@robodoo rebase-ff r+ |
Merge method set to rebase and fast-forward. |
@rco-odoo you may want to rebuild or fix this PR as it has failed CI. |
I'm sorry, @Xavier-Do: this PR is already reviewed, reviewing it again is useless. |
It is currently always a pain to know for sure if a test is running when writing conditional code. - `config['test-tags']` is one of the more reliable, but if starting a server with tests (test-tags, ...) will result in a special state. This is sometime visible when truing to render a report after executing a test, the report will be rendered in html. - module.current_test will only work for at install tests, because it's main purpose was initially to give the module being currently loaded. - module.current_test will only work for at install tests, because it's main purpose was initially to give the module being currently loaded. - threading.testing will only work for the main thread, not the one of a thread serving an http request. The easiest solution is to have a global flag that will always be thruthy when executing a test, no mater if it is at install or post install. The current_test flag is actually the closest one that could cover all cases. It just need to be thruthy when running a post install test. The main reason this flag contains the currently loading module is to fill the _init_modules in some cases, but this shouldn't be useful if the module is already in the _init_modules list This is actually the case since #53499, and some of the hack regarding _init_modules and current_test can be removed. This will allow to recycle this flag to make it True when in test mode, False otherwise. Part-of: #163035
It looks like even with the registry check, we can still have rare case were the websocket request arrives after registry test mode is removed. This fixed by checking it current test is set This flag is more reliable with the pare,t backported commit. closes #163035 Signed-off-by: Raphael Collet <rco@odoo.com>
@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed): |
1 similar comment
@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed): |
@Xavier-Do @rco-odoo this pull request has forward-port PRs awaiting action (not merged or closed): |
It looks like even with the registry check, we can still have rare case were the websocket request arrives after registry test mode is removed.
This is fixed by checking if current test is set
This flag is more reliable, but needs the backport of the new current_test behaviour (#156852).