Commit Graph
14 Commits
Author SHA1 Message Date
Xavier Morel 9f2cfb2cdf [IMP] test_module_operations: make uninstall step more graceful
- process modules to uninstall individually in order to better handle
  their state at that point
- uninstall (and reinstall) modules in provided order, rather than
  whatever postgres feels like (or a sort which might not match what
  we want), mostly useful when uninstalling modules in bulk
- warn if a module is either missing or already uninstalled, rather
  than silently do nothing

closes odoo/odoo#120261

X-original-commit: 034b317a908d1aea6dc6d992c489b30ffff8f1ce
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-05-05 18:08:00 +02:00
Xavier Morel 44f7ccc100 [IMP] test_module_operations: logging configuration
- switch to `dictConfig` for easier bulk-manipulation of loggers
- set `unlink` and `ir_model` loggers to warning, to limit the
  humongous spam that is a normal uninstall session

X-original-commit: bee7898a5af68128b599d30ac7d4c0193e765afd
Part-of: odoo/odoo#120261
2023-05-05 18:07:59 +02:00
Xavier Morel d5a3e3e794 [IMP] module_operation_tester: use subcommands
Add subcommands to make running the script clearer (as exclusive
switches is a bit weird nowadays).

Keep the old `--uninstall` and `--standalone` switches, but make them
mutually exclusive (and optional) to retain current behaviour.

X-original-commit: 933841eda86292f180170b32da621f55fe6f0b84
Part-of: odoo/odoo#120261
2023-05-05 18:07:59 +02:00
Xavier Morel f2de38b84a [IMP] test_module_operations: make debugging easier
- ensure `test_module_operations` exits with a non-zero status on
  failure, as the current makes it a lot less convenient to notice
  uninstall / reinstall errors (especially with lots of warnings
  crowding the logs)
- allow uninstalling without reinstalling, so it's easier to inspect
  db state after uninstall

X-original-commit: 712977faf9bf98d9087368ab4fe95f089a072601
Part-of: odoo/odoo#120261
2023-05-05 18:07:59 +02:00
niyasraphy e83ad17d51 [IMP] core: remove non existing modules from test
document_ftp, website_instantclick, pad, pad_project, note_pad, pos_cache is not currently existing in the addons, removing the non existing modules from the BLACKLIST dictionary.

closes odoo/odoo#107213

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-03-07 18:02:28 +01:00
Victor Feyens bdcd2e60e3 [FIX] test_module_operations: nightly errors
Enable the test for payment modules, as we want to test their install/uninstall.
But disable the test for the deprecated payment modules, which can only be installed
through command line since 16.0.

closes odoo/odoo#107349

X-original-commit: ae559ee083723ff16ec78d93ec781202686553e6
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-12-06 19:09:36 +01:00
Xavier-Do c06b1ede4c [IMP] standalone: log exception when standalone fails
Currently the exception is not logged using the logger meaning that the
only indication of the failure is the "module not loaded" error message.

Catching the exception to log it the proper way will help identifying
the cause of the issue, mainly for uninstall tests.

closes odoo/odoo#100431

X-original-commit: b16f850d9aa438aea91b8cbd7c33692e1e1b2f90
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-09-17 00:52:07 +02:00
Victor Feyens e648489401 [MOV] payment_test: rename to payment_demo
The name "Payment Acquirer Test" of the acquirer bundled with the module
`payment_test` is confusing. It is actually the only acquirer that
doesn't connect to a test API, and its purpose is not to make test
transactions but to showcase the integration of other apps (Accounting,
Sales, eCommerce, Subscriptions) with demo payments.

Hence, the module is renamed to `payment_demo` along with its data and
technical keys to better make the distinction between acquirers' test
environment and demo payments.

task-2853481

closes odoo/odoo#99397

Related: odoo/upgrade#3846
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-09-05 20:13:02 +02:00
Romain DerieandXavier-Do 09f3ff6baf [IMP] tests: allow standalone tests to use ~ in addons-path
Using `./odoo-bin` to start Odoo, the addons path can contain a `~`, eg
`~/Documents/whatever`.
Those `~` are accepted and work both with the `--addons-path` passed as
the command argument, or in the `.odoorc` config file.

The `@standalone` tests (launched with `./test_module_operations.py`)
however did not work with that `~` as the path was not "normalized".
Neither a `~` in the config file or in the `--addons-path` argument were
working.

While it is not very critical, it is a nice to have to have the same
behavior as the `./odoo-bin` as this made me lose quite some time
figuring why I couldn't use my usual `design-themes` repo addons path.

closes odoo/odoo#94953

X-original-commit: e633092a5932f24eda840e1decca92ed238a3a29
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Co-authored-by: Xavier-Do <xdo@odoo.com>
2022-06-30 18:52:31 +02:00
Raphael ColletandXavier Dollé 1595c0ee27 [REF] core: replace thread-local "envs" by cursor-bound "transaction"
Refactor the Environments object into a Transaction object, which is
bound to one cursor, and is no longer shared among several cursors.

The following methods/properties have been changed:
 - Environment.envs no longer works (because of the design change);
 - Environment.manage() is deprecated (no longer useful);
 - Environment.reset() is now an instance method;
 - env.clear_upon_failure() is deprecated in favor of cr.savepoint().

closes odoo/odoo#75598

Related: odoo/enterprise#20451
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
2021-09-03 15:45:46 +00:00
Christophe Monniez 9fce3f83cb [IMP] tests: add data_dir support in test_module_operations
In some situations, like during tests on runbot, the data-dir location
may vary.

With this commit, the `data-dir` CLI argument is added to the
test_module_operations script.

closes odoo/odoo#66492

X-original-commit: 781c91784a0a997967a0152dca2c59a0cb2bab74
Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2021-02-18 16:09:03 +00:00
Nicolas Martinelli 481d1393e7 [FIX] base_setup, website, tests: remove Gengo references
The Gengo modules were removed with:
https://github.com/odoo/odoo/commit/b38b72e456a
https://github.com/odoo/odoo/commit/9b1f0962baa

But there are still references to it.

opw-2349904

closes odoo/odoo#58938

X-original-commit: a30edba504aa1b62aa02092112a55bca65cf9a0c
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-01 17:34:27 +00:00
Xavier Morel ec8a64a85c [REF] core: move testing-related functions to odoo/tests submodules
Attempts to clean up odoo/module and odoo/service a tad, they still
invoke testing-related utilities but are more logical in what
they *contain*.
2020-08-19 07:28:44 +00:00
Adrian Torres ca91e13dee [IMP] testing: forbid module operations during testing
With this commit, module operations such as install, upgrades and
uninstalls are henceforth forbidden inside unit tests and instead such
tests must be performed with standalone Odoo scripts.

This is done because module operations during tests are not
transactional, this can leave the registry in an unclean state and
further tests may be affected by this, it also creates a new registry
which complicates registry cleanup if anything crashes,
because the registry to be cleaned up is not the same one that crashed.

Instead, what should be done is a script that imports odoo as a library,
and loads the database necessary then performs whichever operations
necessary. This script should contain a single function with a single
parameter (env) and should be decorated with
@odoo.tests.common.standalone in order to be executed properly, this
decorator accepts any amount of positional parameters as tags that can
be specified when calling the script in order to execute only a select
subset of scripts.

Special tags are: 'all' and <module_name>, these are generated
automatically, the first will execute ALL scripts available whereas
<module_name> will execute all scripts introduced by said module.

When calling the test_module_operations script, only scripts found in
*installed* modules will be executed, script discovery is only possible
if the code is loaded therefore it is only possible if the module is
installed.

closes odoo/odoo#49669

Signed-off-by: Adrian Torres (adt) <adt@odoo.com>
2020-04-22 07:45:53 +00:00