From 839a27446e140c73493e11cc76c0d216971b2b61 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Wed, 16 Nov 2016 12:41:33 +0100
Subject: [PATCH] tests: fix cache issue causing random failure in
 testAuthenticationPolicy

Traceback (most recent call last):
  File "Products/ERP5/tests/testAuthenticationPolicy.py", line 538, in test_05_HttpRequest
    self.assertFalse(person.isLoginBlocked())
  File "Products/ERP5/mixin/login_account_provider.py", line 68, in isLoginBlocked
    return method(**kw)
  File "ZODB/Connection.py", line 857, in setstate
    raise ConnectionStateError(msg)
ConnectionStateError: Shouldn't load state for 0x6c90 when the connection is closed
---
 product/ERP5Type/tests/ERP5TypeTestCase.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py
index 040bdf5c32..5b4ba71af8 100644
--- a/product/ERP5Type/tests/ERP5TypeTestCase.py
+++ b/product/ERP5Type/tests/ERP5TypeTestCase.py
@@ -695,6 +695,10 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
         # Restore security manager
         setSecurityManager(sm)
 
+        # Make sure that the skin cache does not have objects that were
+        # loaded with the connection used by the requested url.
+        self.changeSkin(self.portal.getCurrentSkinName())
+
         return ResponseWrapper(response, outstream, path)
 
     def getConsistencyMessageList(self, obj):
-- 
2.30.9