Esempio n. 1
0
    Make them faster, but data is lost on crashes. Which is a good
    trade-off for tests.
    """
    for table in reversed(metadata.sorted_tables):
        table: sqlalchemy.Table
        if table.name.startswith("mv_"):
            # Not supported for materialised views.
            continue
        else:
            engine.execute(
                f"""alter table {table.selectable.fullname} set unlogged;""")


module_index = factories.index_fixture("module_db", scope="module")

module_dea_index = factories.dea_index_fixture("module_index", scope="module")

TEST_DATA_DIR = Path(__file__).parent / "data"


@pytest.fixture()
def summary_store(module_dea_index: Index) -> SummaryStore:
    store = SummaryStore.create(module_dea_index)
    store.drop_all()
    module_dea_index.close()
    store.init()
    _make_all_tables_unlogged(_utils.alchemy_engine(module_dea_index),
                              CUBEDASH_METADATA)
    return store

Esempio n. 2
0
from datacube.index import Index
from datacube.index.hl import Doc2Dataset
from datacube.model import Dataset
from datacube.utils import read_documents
from requests_html import HTML

pytest_plugins = "digitalearthau.testing.plugin"

# Use module-scoped databases, as it takes a while to populate with
# our data, and we're treating it as read-only in tests.
# -> Note: Since we're reusing the default config unchanged, we can't use the
#          default index/dea_index fixtures, as they'll override data from
#          the same db.
module_db = factories.db_fixture('local_config', scope='module')
module_index = factories.index_fixture('module_db', scope='module')
module_dea_index = factories.dea_index_fixture('module_index', scope='module')


@pytest.fixture(scope='function')
def summary_store(module_dea_index: Index) -> SummaryStore:
    SummaryStore.create(module_dea_index, init_schema=False).drop_all()
    module_dea_index.close()
    store = SummaryStore.create(module_dea_index, init_schema=True)
    return store


@pytest.fixture(scope='function')
def summariser(summary_store: SummaryStore):
    return summary_store._summariser