• Jérome Perrin's avatar
    ERP5TypeLiveTestCase: close request at the end of each test · e605544e
    Jérome Perrin authored
    This is supposed to fix "Should not load state for ${oid of a skin} when
    the connection is closed" sometimes happening with live tests (especially
    when the test self.publish and the developer access the site while the
    test is suspended on a debugger breakpoint).
    
    The object accessed after the connection is closed was a skin (python
    script, sometimes page template or form) that was cached in SKINDATA.
    The mechanism to prune entries from the cache uses REQUEST.hold API
    which expects that REQUEST.close is called on request, but because
    requests were not closed at the end of the request, it happened that
    the cache was reused from another connection.
    
    This change to close the requests, like ERP5TypeTestCase is doing in
    tearDown (the actual close is done by Testing.ZopeTestCase.connections).
    
    By closing requests at the end of tests, we also have to change so that
    at the beginning of the test we initialize the request, by using the same
    setSite and setupCurrentSkin that are done in ERP5TypeTestCase.
    e605544e
ERP5TypeLiveTestCase.py 11.1 KB