Exemple #1
0
def app_conf(request, tmpdir_factory):
    dataset_path = "test-data/pbmc3k_no_raw.h5ad"

    if not request.param:
        app = create_app()
        configure_app(app, [dataset_path], None, None)
        dataset_id = dataset_path
        os.environ[CIRRO_TEST] = "false"
    else:
        os.environ[CIRRO_TEST] = "true"
        os.environ[CIRRO_DB_URI] = "mongodb://localhost:27018/cirrocumulus-test"
        app = cached_app()
    with app.test_client() as client:
        if request.param:
            # insert dataset
            output_dir = str(tmpdir_factory.mktemp("data").join("test.zarr"))
            PrepareData(
                datasets=[anndata.read(dataset_path)],
                output=output_dir,
                output_format="zarr",
                no_auto_groups=True,
            ).execute()
            r = client.post("/api/dataset", data=dict(url=output_dir, name="test"))
            dataset_id = r.json["id"]
        yield client, dataset_id
Exemple #2
0
def cached_app():
    global app

    if app is None:
        app = create_app()

        # from flask_cors import CORS
        # CORS(app)
        configure()
    return app
Exemple #3
0
def cached_app():
    global app
    if app is None:
        app = create_app()
        configure_app(app)
    return app