Monday, January 21, 2019
5 changes · master
New functionality added to Odoo
This change adds a new test command that makes it easier for teams to run only the Odoo tests they need, helping reduce feedback time during development. It also includes cleanup and reliability fixes across several test areas, improving maintainability without directly changing day-to-day business workflows.
Original PR description
## Test subcommand Adds a test subcommand through py.test (with ~all py.test options forwarded directly): - flexible testing specification, the subcommand can take Odoo modules, directories and/or…
## Test subcommand Adds a test subcommand through py.test (with ~all py.test options forwarded directly): - flexible testing specification, the subcommand can take Odoo modules, directories and/or files as positional parameters and will apply [py.test's discovery conventions](http://pytest.org/latest/goodpractises.html#test-discovery) to fetch Python test cases, "data" test cases will be extracted from a module's `__openerp__.py` if that matches other filters - _only runs selected tests_, if requesting the testing of `product` all its dependencies (and auto_install dependents) are installed (with demo data) but only the tests of `product` are run - with no positional parameters, just starts looking for tests in the current working directory - automatically creates and deletes a temporary db if none is provided, if one is provided does not delete it (but creates it if it's missing) which can allow reusing dbs - uses an inited (but not specifically configured) Odoo logger and a pytest in default display mode (line per test file, captures stdout/stderr) - recap at the end of testing with display of failed test stack traces & captured stderr/stdout - provided marks to ignore categories of tests, only current mark is `http` so `odoo.py test -m 'not http'` will not start an http server and won't run any HTTP test - existing "unittest" tests mostly work as-is (unless they were mucking with the registry or even runtest protocol), alternatively can write lighter "pytest" tests - fixtures make for pretty clean setup/teardown & composition - slightly to greatly faster tests depending on the selected module(s) - future improvements via existing addons (e.g. [pep8](https://pypi.python.org/pypi/pytest-pep8), [coverage](https://pypi.python.org/pypi/pytest-cover)) or more formal results reporting (e.g. [junitxml result logs](http://pytest.org/latest/usage.html#creating-junitxml-format-files)) or new addons for e.g. better JS or tour integration e.g. `odoo.py test mail account` (will run all non-skipped tests in the mail and account addons), `odoo.py test addons/product/tests/test_pricelist.py` (will just run the two test cases in test_pricelist.py), `odoo.py test --pdb -k test_20_pricelist_uom` (will only run that test case, should drop into pdb if the test fails) ## `--test-enable` - most of the registry-installation functions moved to methods of Registry - Registry.load_modules changed to a coroutine and testing part moved outside of it to RegistryManager.new, which external runner does _not_ use see 3219863 - "on-install" testing uses same test discovery subcommand does with custom test reporter - reporting not identical to old reporting but pretty close (and improvement in some ways) - replaced old assertion_reporter (which just counted) by normal assertion errors in XML and YAML - all failed tests summarised/printed at the end of installation, no need to go hunt in the log - remains compatible with runbot (I think, went into runbot source to see how that worked) ## other changes - some tests were implicitly skipped (weren't imported by test package), changed to explicit skipping - various imports improved, some of them may not be necessary after all. May be useful if we eventually try to make just calling `py.test` directly possible - moved and removed imports so pytest and unittest2 are only imported when actually trying to _run_ tests - removed `--test-file` behaviour, superseded by `odoo.py test <testfile>` /cc @odony @antonylesuisse @tde-banana-odoo
Enhancements to existing features
Users can now notify an entire chat channel from the chatter without adding that channel as a follower. This makes broad notifications faster and keeps follower lists cleaner, while also improving how mention suggestions display names.
Original PR description
task_id: 1859802 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Resolved issues and error corrections
This fix restores image-related tools that stopped working after a prior editor update. Website teams can again upload SEO images, choose page backgrounds, select blog covers, and use gallery images reliably.
Original PR description
* web_editor, website_blog Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the media dialog was refactored but the code which used it outside of the editor was not adapted at all. Also, the selected image was not saved correctly anymore, making the media dialog useless outside the editor in the current implementation. - Adapted SEO image uploading and body image background choice which were not working anymore - Adapted blog cover choice and gallery snippet which were strangely still working even though there were sending wrong parameters during media dialog initialization
This fix restores website editor-related dialogs and controls that were crashing after a recent editor update. Website users can again use media, image editing, and customization tools reliably outside the main editor.
Original PR description
* web_editor Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the editor dialog and the switches crashed on their use in website. This is because the merge split some xml files without adapting xml dependencies... this commit only takes care of code which depended on '/web_editor/static/src/xml/editor.xml'.
This fixes a problem where media selection stopped working in Odoo Studio report building blocks after an editor update. Users can again insert or manage media in reports from Studio as expected.
Original PR description
Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the media dialog was refactored but the code which used it outside of the editor was not adapted at all. Enterprise part of https://github.com/odoo/odoo/pull/30416