[pyramid] Do not register repository.shutdown atexit in test mode 3.25
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 20 Mar 2017 14:39:22 +0100
branch3.25
changeset 12079 4870e5a60a52
parent 12078 82d2c1cdf0c2
child 12080 b8c4a8bab7b3
[pyramid] Do not register repository.shutdown atexit in test mode It seems that there already is a special shutdown step for repository in test mode and pyramid's atexit handler interferes with it leading to assertion error about 'shutting_down' attribute being True in Repository.shutdown().
cubicweb/pyramid/__init__.py
--- a/cubicweb/pyramid/__init__.py	Tue Mar 21 14:17:26 2017 +0100
+++ b/cubicweb/pyramid/__init__.py	Mon Mar 20 14:39:22 2017 +0100
@@ -226,7 +226,8 @@
         repo = config.registry['cubicweb.repository'] = cwconfig.repository()
     config.registry['cubicweb.registry'] = repo.vreg
 
-    atexit.register(repo.shutdown)
+    if cwconfig.mode != 'test':
+        atexit.register(repo.shutdown)
 
     if asbool(config.registry.settings.get('cubicweb.defaults', True)):
         config.include('cubicweb.pyramid.defaults')