Commit Graph

403 Commits

Author SHA1 Message Date
Christophe Simonis d05ee26a72 [MERGE] forward port of branch saas-3 up to 24bcdb7 2015-09-22 15:40:28 +02:00
Christophe Simonis 24bcdb75fb [MERGE] forward port of branch 7.0 up to c2aff47 2015-09-22 15:30:22 +02:00
dufresnedavid cc9113f818 [IMP] Prevent unclosed cursor during tests
If an error happens in an overload of setUp, the already-open cursor
is likely not to get properly released before the next test,
deadlocking the db, because tearDown only runs if setUp has
succesfully completed.

Cleanups were added specifically to run every time, after tearDown has
(potentially) been executed.

closes #8327

Note: cleanups run in LIFO order (as they should).
2015-09-17 12:23:09 +02:00
Denis Ledoux 64e44c0a24 [IMP] base: tests, move patch_order to TransactionCase
In order to be able to redefine simply the order
of a model for testing purposes,
without having to re-define this method in each test class.
2015-09-08 11:53:18 +02:00
Christophe Simonis 6e59ea5db9 [FIX] tests: explain why we ignore phatomjs return code 2015-08-06 21:27:03 +02:00
Christophe Simonis d8d9c7277e [FIX] phantomjs test: `phantom` variable is undefined inside page. 2015-08-06 17:20:37 +02:00
Antony Lesuisse b4f7288193 [REM] test: phantom_jsfile method
deprecate phantom_jsfile method, keeping only phantom_js, phantom_js takes a
code argument to run client side only.

Removing phantom_jsfile will allow to switch from phantom to any other engine
such as running google chrome or firefox directly. The only use of
phantom_jsfile was an example.
2015-08-02 14:37:19 +02:00
Xavier Morel 11ba4689b1 [IMP] running speed of some tests & new testcase type
Some tests (e.g. mail) have expensive and significant DB setup for a
number of small and cheap tests. Using a TransactionCase, the DB setup
far dominates the tests themselves, by up to 10x (mail unit tests take
~130s on my machine, the tests themselves take ~15s).

The SavepointCase introduced here is an hybrid of SingleTransactionCase
and TransactionCase: it uses a single transaction for all tests in a
class, but each test case is isolated by a rollbacked savepoint. This
allows a common DB setup (via setUpClass) while keeping independent
tests.

TransactionCase should remain the primary test case superclass, but
SavepointCase can be a fair optimisation when setup costs far dominate.
2015-06-23 16:38:14 +02:00
Damián Soriano f7742add26 [FIX] tests: restore openerp.tests.common.DB for backwards compatibility
It was removed at 2df9060d97 and broke
tests in community modules that relied on it.

Tests using it should switch to the new get_db_name() method.

Closes #7054
2015-06-15 00:52:20 +02:00
Damián Soriano 2df9060d97 [FIX] tests: db name moved from constant to function
Avoids initializing the DB constant too early
when subcommand modules are loaded, making them
unable to run db-backed tests later.

Closes #6984
2015-06-12 12:43:01 +02:00
Christophe Simonis f0dc416871 [FIX] phantomjs 2.0 compatibility
phantomjs 2.0 remove the deprecated attribute `phantom.args`. Use the
new `system` module.
2015-02-26 15:08:17 +01:00
Antony Lesuisse 5a642a802e [FIX] test phantomjs discard stderr
To avoid phantomjs broken pipe messages on odoo stderr during testing.
2015-01-09 01:21:42 +01:00
Raphael Collet 86ba01976e [FIX] tests: make self.assertRaises() return the expected object 2014-11-17 15:39:14 +01:00
Raphael Collet 908252ec88 [FIX] tests: make sure that a failed tests does not leave the environment dirty
When a failure occurs, or when exiting an assertRaises(), the environment
should not contain fields to recompute.
2014-11-17 14:07:42 +01:00
Xavier Morel bc59cfce61 [IMP] doc: add testing reference and improve docstrings 2014-10-09 15:38:36 +02:00
Olivier Dony 79570179bf [MERGE] Forward-port saas-5 up to acbdac4 2014-08-14 14:56:57 +02:00
Olivier Dony acbdac4e9f [MERGE] Forward-port saas-4 up to 9a84d55 2014-08-14 14:54:37 +02:00
Olivier Dony 9a84d55036 [MERGE] Forward-port saas-3 up to 9b55532 2014-08-14 14:37:42 +02:00
Olivier Dony 8b12d1c566 [MERGE] Forward-port of 7.0 up to 85d2b45 2014-08-14 04:11:33 +02:00
Vo Minh Thu 680214c47e [FIX] tools.translate: when loading entries from a PO file, use also the POT.
On Launchpad, as commented on bug 933496, PO entries (and their comments) are
shared between series. This mean that e.g. the 7.0 series can have the wrong
`reference` comments (those beginning with #:) as they would be copied from say
the trunk series. Those `reference` comments are used to import translations
and look them up.

This patch adds a few lines of code to tools.translate so that targets
defined in the POT `reference` comments are used in addition to those from the
PO file.

Also adds a test module to validate the new behavior.

This patch stems from:
 - the 6.1 branch by Vo Minh Thu:
    https://code.launchpad.net/+branch/~openerp-dev/openobject-server/6.1-fix-po-targets-933496-vmt
 - the 7.0 port by Numerigraphe:
    https://code.launchpad.net/~numerigraphe-team/openobject-server/7.0-fix-po-targets-933496-vmt
2014-08-13 23:07:40 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Antony Lesuisse 0ef85c5a60 [FIX] test phantomjs manually delete localstorage 2014-06-30 17:23:38 +02:00
Antony Lesuisse 3bb7866384 [FIX] test phantomjs clear localstorage before running tests 2014-06-30 16:32:02 +02:00
Antony Lesuisse 78e044b5c7 [IMP] test impprove HTTPCase opener
Simplify website crawler using the generic HTTPCase opener
2014-06-29 20:04:30 +02:00
Christophe Simonis 1f57528bc6 [MERGE] forward port of branch saas-5 up to 8dfd5ea 2014-06-27 16:14:40 +02:00
Simon Lejeune ebb3f1aad1 [FIX] use unique localstorage path when running phantomjs tests
this patch use a unique localstorage per test at al request. It could have used one localstorage per instance or even per module.
2014-06-26 14:06:20 +02:00
Christophe Simonis 4cd699df15 [IMP] js testing
- output "error" if any qunit tests failed
- failed js tests are logged as errors
- when running phantomjs considere empty waiting condition or initialisation code as "true"
- lint phantomtest.js file
2014-06-22 11:31:07 +02:00
Antony Lesuisse 739793cdcd [FIX] tests race condition in phanthomjs tests
A deadlock occurs when
- phantomjs_test1 is executedd, enter_test_mode is activated
- console.log('ok') is issued, sigterm is sent to phantomjs_test1 process
- phantomjs_test1 is finished and leave_test_mode restores the registrymanager lock
- phantomjs_test1 process, just before dying, makes a last http request phantomjs_test1_last_request
- phantomjs_test1_last_request thread will wait for the registrymanager lock, when all tests will be completed 
- phantomjs_test2 is run, enter_test_mode is activated
- phantomjs_test2 is reach its end and _wait_remaining_requests is called
- phantomjs_test2 _wait_remaining_requests hangs forever waiting for phantomjs_test1_last_request

bzr revid: al@openerp.com-20140501150641-ua0b7pntesgm3n5p
2014-05-01 17:06:41 +02:00
Antony Lesuisse f0dcf52159 [FIX] instrumentation to debug a deadlock probably due to a race condition in
the test cursor

bzr revid: al@openerp.com-20140411143645-ojb4t9plop4dmizh
2014-04-11 16:36:45 +02:00
Christophe Simonis 95701c28c0 [FIX] test: HttpCase wait http requests to finish
bzr revid: chs@openerp.com-20140410123519-wngil3aghdc6llqc
2014-04-10 14:35:19 +02:00
Raphael Collet e5e00e4c0a [IMP] registry: now cursor() simply returns a cursor, which may itself be used as a context manager
bzr revid: rco@openerp.com-20140409095604-joh9dt0qkma12ykm
2014-04-09 11:56:04 +02:00
Raphael Collet f0fd48c44a [IMP] http tests: implement a test cursor that keeps a transaction open accross requests
- TestCursor subclasses Cursor, and simulates commit and rollback with savepoints
 - the registry manages a test mode, in which it only uses the test cursor
 - a reentrant lock forces the serialization of parallel requests

bzr revid: rco@openerp.com-20140408151736-j0guy68i2wjexy3d
2014-04-08 17:17:36 +02:00
Raphael Collet 6bc60505f4 [IMP] registry: add method get_cursor() to simply retrieve a new cursor, and refactor code to use it
bzr revid: rco@openerp.com-20140408125122-ki0zmin3m21k2itd
2014-04-08 14:51:22 +02:00
Raphael Collet b49f536baf [IMP] tests.common: turn class methods into instance methods (this will ease some future refactoring)
bzr revid: rco@openerp.com-20140408114936-jfagg4qvft8bk3ms
2014-04-08 13:49:36 +02:00
Raphael Collet 81b84c62b1 [IMP] registry: switch for a dummy lock only during the execution of http tests
bzr revid: rco@openerp.com-20140408094513-ahtwod1q17ijohbg
2014-04-08 11:45:13 +02:00
Antony Lesuisse 7c29e3847c [FIX] increase js test timeout to 60
when runbot is overloaded, test speed can be slow, 2s per HTTP request

bzr revid: al@openerp.com-20140403134109-nzg71xmybw1p5bsi
2014-04-03 15:41:09 +02:00
chm@openerp.com 82989d95f7 [FIX] phantomjs: hide error if document.body does not exists
bzr revid: chm@openerp.com-20140325092547-ilnbqdj4rhdo0q3r
2014-03-25 10:25:47 +01:00
chm@openerp.com ea901ebb1d [FIX] phantomjs: don't use error method because it's undefined in phantomjs evaluating environment
bzr revid: chm@openerp.com-20140319112027-buua40iyi7hgnlly
2014-03-19 12:20:27 +01:00
Antony Lesuisse 627b5b671e [FIX] tests dont log traceback on aborted request while testing
bzr revid: al@openerp.com-20140317135239-08aefkdxiil7bpcs
2014-03-17 14:52:39 +01:00
Antony Lesuisse 09deba4826 [FIX] tests dont generate traceback on aborted test requests
bzr revid: al@openerp.com-20140317124343-kgesa5c215z19vpn
2014-03-17 13:43:43 +01:00
Antony Lesuisse 338c0a3f5e [FIX] race condition for test cursors
If a test ends before handling all its http queries (serialised by a Rlock),
threads created for unfufilled queries may hang because the interrupted thread
might not have unlocked its cursor as it might have dissapeared from
HTTP_SESSION before request release_test_cursor. We now use the cursor itself
instead of HTTP_SESSION.

bzr revid: al@openerp.com-20140317031448-rffj7gixgk8jzeqp
2014-03-17 04:14:48 +01:00
Antony Lesuisse cde6e0f6c6 [FIX] no comments
bzr revid: al@openerp.com-20140316212127-l1rxz5zh4o92tv90
2014-03-16 22:21:27 +01:00
Antony Lesuisse c3ef6eb892 [FIX] tests typo in js tests result parsing
bzr revid: al@openerp.com-20140316200135-dyyl6u5uas4js90g
2014-03-16 21:01:35 +01:00
Antony Lesuisse 97a097dbab [IMP] tests log phantom to info the default loglevel of runbot
bzr revid: al@openerp.com-20140316195252-i6wr3scp0zmx92zu
2014-03-16 20:52:52 +01:00
Antony Lesuisse eac5185731 [IMP] phantom tests
- phantomjs more verbose
- revert to dumber console.log relay, dont try to be smart, just display it
- json is only optionally parsed for errors stack dumps

bzr revid: al@openerp.com-20140316160634-hh7br4mbg01xcrpk
2014-03-16 17:06:34 +01:00
Christophe Simonis c7d114d9a9 [MERGE] forward port of branch saas-2 up to revid 5020 chs@openerp.com-20140312174526-a5rhh83g0fw8djuc
bzr revid: chs@openerp.com-20140312180614-8yb454s3mkjwnk2q
2014-03-12 19:06:14 +01:00
Christophe Simonis 1c3ee251f0 [MERGE] forward port of branch 7.0 up to revid 5270 chs@openerp.com-20140403084524-9rb174osjrbmhgwc
bzr revid: chs@openerp.com-20140402083506-w4cywcf0kxxx9xmk
bzr revid: chs@openerp.com-20140312174526-a5rhh83g0fw8djuc
bzr revid: chs@openerp.com-20140318105837-53vsx5g7fm517cuc
bzr revid: dle@openerp.com-20140326092548-bu4bqinhvco8j5wj
bzr revid: chs@openerp.com-20140402092735-3a23yjl169vvt0iv
bzr revid: chs@openerp.com-20140402112825-ky8rcb3p467ikitc
bzr revid: chs@openerp.com-20140403084808-slnj7uis17kwi9js
2014-04-03 10:48:08 +02:00
Antony Lesuisse 096432ff73 [REV] reverting xmo@openerp.com-20140310115334-vjh7gx5oizdm6s67
This api change breaks jsfile tests (example test_ui_load.js). The api is broken
but the proper fix would be to avoid accessing phantom.args from PhantomTest

bzr revid: al@openerp.com-20140310184636-8r9x81xi1zqhcsek
2014-03-10 19:46:36 +01:00
Xavier Morel aaa80e9575 [IMP] phantomjs driver cleanups
bzr revid: xmo@openerp.com-20140310115334-vjh7gx5oizdm6s67
2014-03-10 12:53:34 +01:00
Xavier Morel bcbe89fbdc [IMP] phantomjs waitloop
* simplify waitFor itself
* log a "waiting for" message if the expression evaluates but is *false*

bzr revid: xmo@openerp.com-20140310112401-khvy0zcvwaaxa5om
2014-03-10 12:24:01 +01:00