コード例 #1
0
def ensemble_backend(request):
    """
    This fixture reads a pre-compiled ensemble predictions that physically
    reside in the test directory. They were created beforehand to make sure
    ensemble building is correct
    """
    test_id = '%s_%s' % (request.module.__name__, request.node.name)
    test_dir = os.path.join(this_directory, test_id)

    try:
        shutil.rmtree(test_dir)
    except:  # noqa E722
        pass

    # Make sure the folders we wanna create do not already exist.
    backend = BackendMock(test_dir)

    def get_finalizer(ensemble_backend):
        def session_run_at_end():
            try:
                shutil.rmtree(test_dir)
            except:  # noqa E722
                pass

        return session_run_at_end

    request.addfinalizer(get_finalizer(backend))

    return backend
コード例 #2
0
def ensemble_backend(request):
    test_id = '%s_%s' % (request.module.__name__, request.node.name)
    test_dir = os.path.join(this_directory, test_id)

    try:
        shutil.rmtree(test_dir)
    except:  # noqa E722
        pass

    # Make sure the folders we wanna create do not already exist.
    backend = BackendMock(test_dir)

    def get_finalizer(ensemble_backend):
        def session_run_at_end():
            try:
                shutil.rmtree(test_dir)
            except:  # noqa E722
                pass

        return session_run_at_end

    request.addfinalizer(get_finalizer(backend))

    return backend