Skip to content

Commit 70f4d9d

Browse files
committed
fix: Unrunnable tests should skip
1 parent 19c7afe commit 70f4d9d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tools/schemacode/src/bidsschematools/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def fixture(tests_data_dir):
9696
def schema_dir() -> Generator[str, None, None]:
9797
"""Path to the schema housed in the bids-specification repo."""
9898
with data.load.as_path("schema") as schema_path:
99+
if not schema_path.exists():
100+
pytest.skip("No schema found; probably in an installed package")
99101
yield str(schema_path)
100102

101103

tools/schemacode/src/bidsschematools/tests/test_schema.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88

99
from bidsschematools import __bids_version__, schema, types
1010

11-
from ..data import load
1211

13-
14-
def test__get_bids_version(tmp_path):
12+
def test__get_bids_version(schema_dir):
1513
# Is the version being read in correctly?
16-
schema_path = str(load("schema"))
17-
bids_version = schema._get_bids_version(schema_path)
14+
bids_version = schema._get_bids_version(schema_dir)
1815
assert bids_version == __bids_version__
1916

17+
18+
def test__get_bids_version_fallback(tmp_path):
2019
# Does fallback to unknown development version work?
2120
expected_version = "1.2.3-dev"
2221
schema_path = os.path.join(tmp_path, "whatever", expected_version)

tools/schemacode/src/bidsschematools/tests/test_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def test_select_schema_path(bids_examples, tmp_path):
274274
assert schema_path is None
275275

276276

277-
def test_bids_schema_versioncheck(monkeypatch):
277+
def test_bids_schema_versioncheck(monkeypatch, schema_dir):
278278
"""Test incompatible version."""
279279
import bidsschematools as bst
280280

0 commit comments

Comments
 (0)