2023-08-21 06:00:58 +00:00
|
|
|
import pytest
|
2023-09-12 02:55:45 +00:00
|
|
|
import os
|
2023-08-21 06:00:58 +00:00
|
|
|
|
2023-09-06 04:47:41 +00:00
|
|
|
from nwb_linkml.io import schema as io
|
|
|
|
from nwb_linkml.adapters.namespaces import NamespacesAdapter
|
2023-08-21 06:00:58 +00:00
|
|
|
import shutil
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def tmp_output_dir() -> Path:
|
|
|
|
path = Path(__file__).parent.resolve() / '__tmp__'
|
|
|
|
if path.exists():
|
|
|
|
shutil.rmtree(str(path))
|
|
|
|
path.mkdir()
|
|
|
|
|
|
|
|
return path
|
|
|
|
|
2023-09-12 02:55:45 +00:00
|
|
|
@pytest.fixture(autouse=True, scope='session')
|
|
|
|
def set_config_vars(tmp_output_dir):
|
|
|
|
os.environ['NWB_LINKML_CACHE_DIR'] = str(tmp_output_dir)
|
|
|
|
|
|
|
|
|
2023-08-21 06:00:58 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
2023-08-22 04:43:02 +00:00
|
|
|
def nwb_core_fixture() -> NamespacesAdapter:
|
2023-08-21 06:00:58 +00:00
|
|
|
nwb_core = io.load_nwb_core()
|
2023-08-22 04:43:02 +00:00
|
|
|
nwb_core.populate_imports()
|
2023-09-12 02:55:45 +00:00
|
|
|
return nwb_core
|
|
|
|
|
2023-09-26 05:03:53 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def data_dir() -> Path:
|
|
|
|
path = Path(__file__).parent.resolve() / 'data'
|
|
|
|
return path
|