Commit Graph
58 Commits
Author SHA1 Message Date
Christophe Monniez 4ba6d2a405 [IMP] tests: make phantomjs work on Windows
Since Python 3.2, close_fds parameter is True by default on POSIX
platforms. On Windows, it's set to False when one of the standard descriptors
is set.

This commit will give the opportunity to run phantom js tests on
Windows.
2018-04-10 09:32:30 +02:00
Thibault Delavallée a03f8da8e4 [IMP] tests: allow to add a margin on performance tests
Purpose of this commit is to avoid errors for some performance tests that
have a slightly variable number of queries. Indeed some tests in test_mail
module vary of 1 or 2 queries due to a behavior still not found that does
not seem deterministic.

This should not be considered as a real error, but should not be considered
as completely valid. This is why a margin is accepted in some tests that
will raise a warning instead of an error. This warning tells people to
check if they have increased the query counter or if it is due to a random
effect in query count.

This is a manual forward-port of saas-11.2 commit 3fe0ee5ae6 .
2018-04-09 17:28:03 +02:00
Laurent Smet 34c7fe2e77 [FIX] testing utilities: o2m should not strip readonly fields
In the normal course of saving-action, readonly fields are stripped
out when sending data to the server. The SSF would reuse the same code
when "saving" O2M lines to the parent record however that is not
correct and would lead to misbehaving views as readonly (non-stored)
fields used as "transients" (storing data within the extent of a
record's edition session) would not behave properly.

Fix by overriding the O2M Form's save so that readonly fields are
kept and stored in the parent record.

Closes #23620
2018-04-03 15:46:04 +02:00
Christophe Simonis b51f2d38c2 [MERGE] forward port branch saas-11.2 up to 500e3f4970 2018-03-21 11:04:48 +01:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Christophe Simonis 672a275c7f [MERGE] forward port branch saas-15 up to 3d9a2340d9 2018-03-19 21:26:01 +01:00
Christophe Simonis 3d9a2340d9 [MERGE] forward port branch saas-14 up to e098276644 2018-03-19 19:51:33 +01:00
tbe-odoo da1f153d61 [IMP] http: Sessions implicit deactivation
- Store a token inside sessions to allow implicit session deactivation when needed.
2018-03-19 18:11:12 +01:00
Raphael Collet 7ea4f13f16 [REF] tests: TestCursor is now a proxy to a real Cursor
This allows rpc requests in `HttpCase` to use the cursor `self.cr`, which is
now shared between the Python test and the rpc requests.  This simplifies code
to prepare a JS test, and code to check the result of a JS tour.

Fixes #12237
2018-02-12 10:31:59 +01:00
xmo-odoo c385f5f418 [FIX] base: correctly handle non-normalised domains in SSF
Turns out I'd kinda skipped that bit.

Fixes #22711
2018-02-01 15:24:38 +01:00
Christophe Monniez b356b19033 [IMP] tests: Add the possibility to tag tests
Purpose: When running tests, all the tests for the installed/updated
files are done. This commit adds a 'tagged' decorator that can be used to
tag tests. Combined with a new 'test-tags' CLI option, it adds the ability
to filter which tests are executed. For example, @tagged('slow') will
add a tag 'slow' to the test. The CLI option 'test-tags="slow"' will
only run tests tagged 'slow'.

One can use prefixes to select cases with tags.
'+' or no prefix means that the tests tagged with this tag are selected
for execution. '-' prefix will exclude the tests tagged with this tag.
Exclusion takes precedence over inclusion.

Also, by default, all Odoo tests cases are tagged 'standard' and with
the technical name of the module.
This means that when selecting tests with the 'test-tags'
parameter, if '-standard' is not specified, all tests tags are
going to be executed.
When tagging tests, one can remove such automatic tag by prefixing the
tag name with '-'. E.g. @tagged('-standard') will remove the standard
tag from the test.

Another example, if one wants to test the 'sale' module alone,
even without adding any 'tagged' decorator thos tests can be selected
like that: --test-tags="sale"

Tests are selected or deselected using a TagsSelector. When instanciated,
 a string is passed with comma separated tests selectors like
'+slow,-standard'. When the 'check' method is called  with a test as argument,
it returns True or False if the test has to be executed or not.
2018-01-18 13:20:37 +01:00
Raphael Collet ba25420312 [REF] tests: decorators and method to count queries (#21499)
Add the context manager method `assertQueryCount` to count queries,
the decorator `@users(...)` to execute a test for several users, and
the decorator `@warmup` to execute a test twice (warm-up, then real).
2017-12-12 15:52:35 +01:00
Xavier Morel 3c4c192cae [FIX] sale_mrp, stock_dropshipping: suppress warnings
* create product correctly (via form) & enable crossdock route
  otherwise no purchase order is created (surprise!)
* silence logger when creating SO as apparently stock warning can not
  be disabled even when it makes no sense
* suppress warning about cost methods when creating a product
  category, that's apparently normal (happens every time on runbot)
2017-12-04 13:11:57 +01:00
Xavier Morel 346d770291 [FIX] sale_mrp: clear product routes before adding manufacturing ones
If purchase happens to be installed before MRP is, the "buy" route is
set by default on products *and* takes precedence over the MRP
one (because created first and same sequence).

This leads to purchase trying to buy products (which have no seller)
instead of MRP trying to manufacture them, which is what we're trying
to do & test.

Fix by clearing the route_ids field before adding the MRP routes.
2017-12-04 13:11:56 +01:00
Xavier Morel d59abc4c74 [ADD] doc: Form & proxies 2017-12-04 13:11:55 +01:00
Xavier Morel 804169fa98 [IMP] sale_mrp: Formify tests
* warn on onchange warning instead of error
* fallback on a node not having modifiers attributes
* required field should apparently fail on False but not 0 or 0.0
* improve error message when adding an incorrect object or model to an
  o2m
  * remove useless test_move_explode
2017-12-04 13:11:55 +01:00
Xavier Morel df695e2d92 [IMP] stock_dropshipping: convert tests to SSF 2017-12-04 13:11:55 +01:00
Xavier Morel 4bf97bdbe2 [ADD] base: server-side formview
Useful to better test business flows & replace yaml test files:
instantiating records & calling onchanges by hand is very
error-prone (it's easy to miss onchanges, or to manually set fields
which can't be set through the view we're interested in, ...)

odoo.tests.common.Form implements the basic *creation*
flow (fields_get, default_get, onchange) up to saving the record,
including proper handling of the required and readonly modifiers &
their domains.

* edition of existing records, including filtering out unmodified
  fields when saving
* possibly buttons
* ensuring the API is convenient
2017-12-04 13:11:53 +01:00
Thibault Delavallée ea6415bd90 [IMP] odoo: tests: allow to compare HtmlElement trees
addTypeEqualityFunc does not work for subclasses. Therefore if we want
to be able to compare html trees we have to add the equality check for
html elements which are children of _Element.
2017-11-29 10:05:01 +01:00
Christophe Simonis 29590a61cd [MERGE] forward port branch 11.0 up to 8fb25e185b 2017-11-28 16:57:58 +01:00
Christophe Simonis 5851a69aa3 [MERGE] forward port branch saas-16 up to 3f66814a0d 2017-11-28 15:12:31 +01:00
Moises Lopez - https://www.vauxoo.com/ eb90eb42ce [IMP] translate: export empty translations for empty ones
Instead of use the original string by default.

Currently odoo export a PO translation file using the logic:
"If there is not a translation then use the source."

This generate a false 100% of file translated for tools based on PO
files.

This commit change this logic to:
"If there is not a translation then use empty string."

Odoo import a PO translation file supporting empty string because
if a item is empty string odoo use the original source.

Closes #17925
2017-11-21 17:56:28 +01:00
Géry Debongnie 98f72efcbe [FIX] web_tour: add some logging messages
With this commit, we add a few extra logs to help debugging issues with
phantomjs.

I suspect that the recent problems with phantomjs are due to the
localstorage not being cleared properly, but the logs are not sufficient
to determine the exact cause.
2017-11-21 16:11:59 +01:00
Thibault Delavallée 52f899aae7 [FIX] odoo: tests: correctly call super
Otherwise inheritance is not always possible because child classes
inheriting from the base class are not called.
2017-11-20 11:08:28 +01:00
Yannick Tivisse 7a22cbe5f7 [IMP] test_translation_import: Remove tests.yml
The test is already implemented in python in 'odoo/tests/addons/test_translation_import/tests/test_term_count.py'
2017-11-16 14:49:05 +01:00
Olivier Dony e58e0c268c [IMP] server: rename xmlrpc* related parameters
The 'xmlrpc'-based configuration parameters have been a misnomer since
the introduction of the generic HTTP service, years ago.

Hide these options from the server parameters, and replace them with
more appropriate 'http' ones:

 --xmlrpc-interface -> --http-interface
 --xmlrpc-port      -> --http-port
 --no-xmlrpc        -> --no-http

The config entries for these have been adapted as well.

The old parameter names are still silently supported in both
command-line arguments and config files. However they are
stored with the new names in the `tools.config` dict,
and when saving config files (with the -s option).

Also clarified and cleaned up the descriptions of the HTTP/WEB server
parameters.

And finally, added a short version `-p`, for the `--http-port` option.
Credits to @dreispt for this (via #19518)

Closes #19518
Closes #19778
2017-09-29 18:18:03 +02:00
Xavier Morel 8361ec8819 [FIX] phantomjs for p3
P2 and P3 subprocess stdout seem to have very odd/different behaviours
in the face of mixing select and buffering.

Use raw/low-level IO (os.read) with select to try and fix that
up. Also read more than one byte at a time since os.read will not
block *if* the fd is readable, it will just get whatever data is
immediately available.
2017-08-23 14:34:50 +02:00
Xavier Morel 97515adde4 [FIX] P3: phantomjs & text model
In P3, can only append integers to bytearray, not bytes, also fix some
byte/string comparisons & encoding crap
2017-08-20 23:25:54 +02:00
Christophe Simonis 48b2ce60ed [MERGE] forward port branch saas-16 up to 85571bb78c 2017-08-10 17:01:05 +02:00
Christophe Simonis 85571bb78c [MERGE] forward port branch saas-15 up to dde62073ba 2017-08-10 16:22:36 +02:00
Christophe Simonis c3d710d2f6 [MERGE] forward port branch saas-14 up to 80ac087d6e 2017-08-09 17:11:10 +02:00
Fabien Meghazi 2c0f6f39d7 [IMP] http: improve dumpstacks and remaining requests handling during tests (#18640)
This patch modifies Root#dispatch() in order to keep the httprequest url
in the current thread's attribute and use if for dumpstacks and the
phantomjs tests remaining requests handling.

Also added a counter in order to avoid looping forever when trying to join unclosed http requests
in phantomjs test suite after a phantomjs failure + added a log.warning in such a case so it's easier to troubleshoot runbot's ir.logging.
2017-08-03 10:50:18 +02:00
Christophe Simonis 072411b336 [MERGE] forward port branch saas-16 up to 8d89148d13 2017-08-02 01:08:42 +02:00
Christophe Simonis 8d89148d13 [MERGE] forward port branch saas-15 up to 5e19f28bfc 2017-08-01 23:11:27 +02:00
Christophe Simonis 5e19f28bfc [MERGE] forward port branch saas-14 up to d0ece6cd89 2017-08-01 23:07:22 +02:00
Christophe Simonis d1cf4f9672 [MERGE] forward port branch saas-11 up to ed36929265 2017-08-01 22:39:16 +02:00
Xavier Morel 8f6e5dbdd3 [FIX] P3: assertItemsEqual is called assertCountEqual
The python 3 name is more correct as to what the assertion actually
does, but still makes for a breaking change.
2017-06-26 16:45:02 +02:00
Christophe Simonis e1c74e374c [MERGE] forward port branch saas-14 up to 3bac72ba74 2017-06-26 14:04:04 +02:00
Christophe Simonis 6981320d01 [MERGE] forward port branch saas-11 up to 79dfcde359 2017-06-21 18:28:26 +02:00
Richard Mathot 2dcf233a28 [IMP] tests: better reporting of PhantomJS crashes
When PhantomJS crashes due to a memory leak/segmentation fault, it will
now be logged, allowing to distinguishes timeouts from crashes more
easily.
2017-06-16 14:21:12 +02:00
Xavier Morel 1328416959 [FIX] P3: hash randomisation in XML/HTML stuff
* Have the cleaned up style attributes be dumped in the same order
  they were originally so that we can easily validate against text
  content.
* While lxml's attributes are stored in an ordereddict, namespaces are
  not and thus when comparing text serialisation of namespaced
  documents the ordering of namespaces can differ between runs.

  Fix by comparing the LXML trees directly.
2017-06-12 11:04:23 +02:00
Xavier Morel 01e3514147 [FIX] P3: urllib, urllib2 and urlparse
In Python 3, all of these were "consolidated" under urllib(.request,
.parse, .errors) which is inconvenient.

Since we already have hard dependencies on requests and
werkzeug(.urls, which is a backport of Python 3's unicode-aware
urllib.parse) migrate *everything* to that.

A sticking point is urllib2.URLError, those were (mostly) replaced by
the slightly more general IOError which URLError extends.
2017-05-15 12:26:30 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +02:00
Raphael Collet b59318ec12 [REF] registry: always perform registry/cache signaling at the end of request
Problem: the update of custom models/fields is not fully transactional, and may
potentially lead to an inconsistent database.  An other problem is creating two
custom fields by writing on a model: if the second one fails, the first one has
been committed without notice.  Retrying the request will give an unexpected
error (duplicate field name).

Solution: never commit in the middle of a request.  If the changes have an
impact on the registry, then mark it as invalid (with a new flag), and signal
registry invalidation after everything has been committed.  If the request
fails, reset the registry.  Both registry and cache invalidation are handled
the same way.
2017-05-03 15:41:05 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
xmo-odoo 2e6a589f41 [FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch
* thin compat module stripped down from werkzeug (to augment as needed)

issue 8530
2017-04-27 13:59:33 +02:00
Xavier Morel 3979f6802e [#8530] convert exception handlers to except..as syntax
Futurize fixers:
* lib2to3.fixes.fix_except
2017-04-11 14:53:29 +02:00
Martin Trigaux d84b795b0a [ADD] test_translation_import: new no update test
To verify the translations are indeed not overwritten
2017-03-29 13:41:09 +02:00
mge-odoo ff2f188d20 [IMP] tests: allow post-install tests to play real transactions
Move the post-install tests execution outside `Registry.new`, and add a flag on
class `HttpCase` to enable/disable the registry "test mode".

This allows a test to run actual transactions that will reload the registry,
which may be used to test the creation of `ir.model` instances, etc.
2017-02-08 16:13:01 +01:00
qdp-odoo 4f29b77e3d [MERGE] foward port of 10.0 up to revision 84a650e33a 2016-12-30 17:21:25 +01:00