• Kirill Smelkov's avatar
    fixup! *: Use defer for dbclose & friends · b6916ca8
    Kirill Smelkov authored
    In 5c8340d2 we said:
    
        dbclose now uses defer almost everywhere - there are still few places in
        tests, where one test function is opening/closing test database multiple
        times - those were not (yet ?) converted.
    
    Let's convert those remaining places now, because when wendelin.core
    tests are run wrt plain ZODB4 (contrary to ZODB4-wc2), many tests fail
    at fileh_open time, e.g.
    
            @func
            def test_bigfile_filezodb_fileh_gc():
                root1= dbopen()
                conn1= root1._p_jar
                db   = conn1.db()
                defer(db.close)
                root1['zfile4'] = f1 = ZBigFile(blksize)
                transaction.commit()
    
        >       fh1  = f1.fileh_open()
    
        bigfile/tests/test_filezodb.py:588:
        _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
        bigfile/file_zodb.py:603: in fileh_open
            fileh = _ZBigFileH(self, _use_wcfs)
        bigfile/file_zodb.py:664: in __init__
            self.zfileh = zfile._v_file.fileh_open(use_wcfs)
        bigfile/_file_zodb.pyx:112: in wendelin.bigfile._file_zodb._ZBigFile.fileh_open
            pywconn   = wczsync.pywconnOf(zconn)
        wcfs/client/_wczsync.pyx:56: in wendelin.wcfs.client._wczsync.pywconnOf
            wconn = wc.connect(zconn_at(zconn))
        lib/zodb.py:163: in zconn_at
            "ZODB!1")
        _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
        patch = 'conn:MVCC-via-loadBefore-only', details_link = 'ZODB!1'
    
            def _zassertHasNXDPatch(patch, details_link):
                if not _zhasNXDPatch(patch):
                    raise AssertionError(
                        "ZODB%s is not patched with required Nexedi patch %r\n\tSee %s for details" %
        >               (zmajor, patch, details_link))
        E           AssertionError: ZODB4 is not patched with required Nexedi patch 'conn:MVCC-via-loadBefore-only'
        E               See ZODB!1 for details
    
    and DB is left unclosed.
    
    This change should reduce, if not completely fix, the number of
    leaked /tmp/testdb_* directories for Wendelin.core.UnitTest-ZODB4(xfail) testsuite.
    b6916ca8
Name
Last commit
Last update
..
tests Loading commit data...
.gitignore Loading commit data...
__init__.py Loading commit data...
_bigfile.c Loading commit data...
_bigfile.h Loading commit data...
_file_zodb.pyx Loading commit data...
file_file.py Loading commit data...
file_zodb.cpp Loading commit data...
file_zodb.py Loading commit data...
pagefault.c Loading commit data...
pagemap.c Loading commit data...
ram.c Loading commit data...
ram_hugetlbfs.c Loading commit data...
ram_shmfs.c Loading commit data...
virtmem.c Loading commit data...