• Julien Muchembled's avatar
    qa: make closure of NEOCluster more reliable in treaded tests · e2183483
    Julien Muchembled authored
    Instances of NEOCluster were not deleted as soon as the only referrers were
    weak proxies (at least that's what a quick check with the 'gc' module showed
    at the beginning of tearDown). In some cases, __del__ was called while the next
    test was logging a message, which led to deadlocks.
    
    Without those proxies, it may be reliable, but only on CPython. See
      http://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies
    
    Relying on __del__ to close a cluster was wrong. NEOCluster is now a context
    manager that does it explicitly at exit, in addition to automatically stop it.
    The NEOCluster.stop method combines the previous stop/__del__/reset methods.
    
    A new 'with_cluster' decorator is also added to avoid excessive indentation
    in tests. Unindentation of existing tests will be done later.
    e2183483
__init__.py 2.11 KB