Skip to content
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

[17.0][MIG] test_component: Migration to 17.0 #477

Closed

Conversation

nguyenminhchien
Copy link

@nguyenminhchien nguyenminhchien commented Nov 27, 2023

guewen and others added 30 commits November 27, 2023 10:43
The favorite lookup should be by 'usage' (kinda interface) and by model
name ('components()' method).  The lookup by component name should
normally not be used as it reduces the flexibility.  Using a different
method for this lookup discourage its usage.  Also, the lookup by
component name completely ignores the current collection, which is bad
or not bad depending of what you want to achieve.
That thinks the file contains tests.
Because they need the registry to be initialized, otherwise no component
exist
the 'components' method had 2 different return types depending of the
'multi' argument.

Now we have 'component' or 'many_components' that return a Component
instance or a list of Component instances.
Because they can have different addons
It allows to open/close objects on start/end of a synchro / work
session. The base method does none of that, but this is a really common
use case. Example: at the beginning of the work session, I open a
webservice client that is available in our WorkContext for the duration
of our work. At the end, I close the client to end the connection.
When we want to test the implementation of a connector, it must be
simple. Add 2 new test cases for TransactionCase and SavepointCase which
load all the components of the dependencies addons on the tested addons.
Only the components of the addons in state 'installed' are loaded, so we
don't load components of addons that depend on the tested addon.

The tests must call _init_global_registry and build_registry instead of
_register_hook, so the registry is not set to ready. If the global
registry is set to ready during tests, the event will trigger during the
installation of addons which is not what we want.

The existing test case is meant only to be used when one has to
manipulate components in a custom registry.

See discussion on
guewen@447b22f#commitcomment-22851711
lmignon and others added 12 commits November 27, 2023 10:43
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: connector-16.0/connector-16.0-test_component
Translate-URL: https://translation.odoo-community.org/projects/connector-16-0/connector-16-0-test_component/
Currently translated at 77.7% (7 of 9 strings)

Translation: connector-16.0/connector-16.0-test_component
Translate-URL: https://translation.odoo-community.org/projects/connector-16-0/connector-16-0-test_component/it/
Currently translated at 88.8% (8 of 9 strings)

Translation: connector-16.0/connector-16.0-test_component
Translate-URL: https://translation.odoo-community.org/projects/connector-16-0/connector-16-0-test_component/it/
Currently translated at 100.0% (9 of 9 strings)

Translation: connector-16.0/connector-16.0-test_component
Translate-URL: https://translation.odoo-community.org/projects/connector-16-0/connector-16-0-test_component/es/
Currently translated at 100.0% (9 of 9 strings)

Translation: connector-16.0/connector-16.0-test_component
Translate-URL: https://translation.odoo-community.org/projects/connector-16-0/connector-16-0-test_component/it/
@nguyenminhchien nguyenminhchien marked this pull request as ready for review November 27, 2023 05:06
@nguyenminhchien nguyenminhchien mentioned this pull request Nov 27, 2023
6 tasks
@simahawk
Copy link
Contributor

/ocabot migration test_component

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Nov 27, 2023
@nguyenminhchien
Copy link
Author

Merged the migration of test_component into #474

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.