• Philippe Pepiot's avatar
    Make test database template creation concurrent · e385c9732f1e
    Philippe Pepiot authored
    build_db_cache() is used in tests to create test database templates, i.e.
    DEFAULT_EMPTY_DB_ID (which is __default_empty_db__) and custom template
    database using CubicwebTC test_db_id/pre_setup_database API.
    When running tests in parallel using multiple processes, build_db_cache() may
    try to build the same database twice. Avoid this by adding synchronisation of
    process by using a file lock.
    So when two processes require the same template database, one build the
    database and others wait it to be created.
    Use filelock (https://github.com/benediktschmitt/py-filelock) library to have a
    portable (unix / windows) way for handling locks.
    Also filelock is packaged in debian: https://packages.debian.org/source/python-filelock