ERP5Type/tests: review requests in test
The general idea of this patch is that now that we are using zope.globalrequest, we no longer need to patch get_request, we can simply call zope.globalrequest.setRequest with the request from the test and restore the "real" request afterwards. To achieve this, we reuse Testing.ZopeTestCase.connections.registry, which already has the logic of cleaning up resources in the right place and use a "Request" resource that calls setRequest(test_request) and setRequest(real_request) when closed, so that: - test runs with an independant request - this test request is closed at the end - the real request is restored at the end This also fixes a bug with self.publish when runnning ERP5TypeLiveTestCase from portal_components of a running instance, after a call to self.publish the current request was lost. The testing for this revealed that ERP5TypeLiveTestCase.publish way of dealing with zope.security interaction was not always correct: when running a live test inside runUnitTest (like we do here in testDynamicClassGeneration), there is no security interaction. This was reviewed to use the high level API instead of changing directly the internal storage.
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
passed |
#588385
external
|
ERP5.CodingStyleTest-TestRunner2 |
00:51:22
|
||||||
failed |
#588442
external
|
ERP5.UnitTest-TestRunner2 |
01:57:02
|
||||||
failed |
#588441
external
|
ERP5.UnitTest-Zope2-ForTestRunner2 |
02:05:05
|
||||||
passed |
#588239
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
00:57:54
|
||||||
passed |
#587618
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
00:37:33
|
||||||
passed |
#588293
external
retried
|
ERP5.CodingStyleTest-TestRunner2 |
01:40:28
|
||||||
failed |
#588238
external
retried
|
ERP5.UnitTest-TestRunner2 |
03:37:34
|
||||||
passed |
#587626
external
retried
|
ERP5.UnitTest-TestRunner2 |
02:34:46
|
||||||
failed |
#588378
external
retried
|
ERP5.UnitTest-TestRunner2 |
03:13:23
|
||||||
passed |
#587619
external
retried
|
ERP5.UnitTest-Zope2-ForTestRunner2 |
01:33:37
|
||||||
failed |
#588379
external
retried
|
ERP5.UnitTest-Zope2-ForTestRunner2 |
02:19:00
|
||||||
failed |
#588234
external
retried
|
ERP5.UnitTest-Zope2-ForTestRunner2 |
03:51:02
|
||||||