TEST: Add bids_examples fixture
@@ -13,8 +13,10 @@ e.g.
... assert bids.config.get_option("extension_initial_dot") == extension_initial_dot
"""
-
+import os
+from pathlib import Path
from unittest.mock import patch
+
import pytest
@pytest.fixture
@@ -34,3 +36,17 @@ def mock_config(config_paths, extension_initial_dot):
bids.config._settings['config_paths'] = config_paths
bids.config._settings['extension_initial_dot'] = extension_initial_dot
yield
+
+@pytest.fixture(scope='session')
+def bids_examples():
+ examples_dir = Path(os.getenv(
+ "BIDS_EXAMPLES",
+ Path(__file__).absolute().parent.parent / "bids-examples"
+ ))
+
+ if not Path.is_dir(examples_dir / "ds001"):
+ pytest.skip(
+ f"BIDS examples missing from {examples_dir}. "
+ "Override default location with BIDS_EXAMPLES environment variable."
+ )
+ return examples_dir
