Skip to content

Commit 8bb0cf2

Browse files
authored
Merge branch 'main' into rf/schemaadapter
2 parents e8464c1 + 2543599 commit 8bb0cf2

4 files changed

Lines changed: 47 additions & 37 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
name: CI
22

3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
37
on:
48
push:
5-
branches: ["main"]
9+
branches: [ "main" ]
610
pull_request:
7-
branches: ["main"]
11+
branches: [ "main" ]
812

913
env:
1014
UV_FROZEN: true
15+
COVERAGE_PYTHON: "3.12"
1116

1217
jobs:
1318
format:
1419
runs-on: ubuntu-latest
1520
steps:
16-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
1722
with:
1823
submodules: "true"
19-
- name: Install uv
20-
uses: astral-sh/setup-uv@v5
21-
with:
22-
pyproject-file: pyproject.toml
23-
- name: Install the project
24-
run: uv sync --all-extras
24+
- uses: astral-sh/setup-uv@v8.1.0
25+
- run: uv sync --all-extras
2526
- name: Check quality
2627
run: |
2728
uv run ruff check bids2table tests
@@ -32,26 +33,45 @@ jobs:
3233
needs: format
3334
strategy:
3435
matrix:
35-
python-version: ["3.11", "3.12", "3.13"]
36+
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
3637
steps:
37-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v6
3839
with:
3940
submodules: "true"
40-
- name: Install uv with python version
41-
uses: astral-sh/setup-uv@v6
41+
- uses: astral-sh/setup-uv@v8.1.0
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

4545
- name: Run tests without cloudpathlib
4646
run: |
47-
uv run pytest tests
47+
uv run pytest \
48+
-m "not cloud" \
49+
--junitxml=pytest-cloudless.xml \
50+
--cov-report=xml:coverage.xml \
51+
--cov bids2table \
52+
tests
53+
4854
- name: Run tests with cloudpathlib
4955
run: |
50-
uv run --all-extras pytest \
51-
--junitxml=pytest.xml \
56+
uv run --extra cloud pytest \
57+
-m "cloud" \
58+
--junitxml=pytest-cloud.xml \
5259
--cov-report=xml:coverage.xml \
53-
--cov=bids2table tests
54-
- name: Upload coverage to Codecov
55-
uses: codecov/codecov-action@v4
60+
--cov=bids2table \
61+
--cov-append \
62+
tests
63+
64+
- name: Merge JUnit XML reports
65+
run: |
66+
uvx junitparser merge \
67+
pytest-cloudless.xml \
68+
pytest-cloud.xml \
69+
pytest.xml
70+
71+
- name: Pytest coverage comment
72+
if: github.event_name == 'pull_request' && matrix.python-version ==
73+
env.COVERAGE_PYTHON
74+
uses: MishaKav/pytest-coverage-comment@v1
5675
with:
57-
token: ${{ secrets.CODECOV_TOKEN }}
76+
pytest-xml-coverage-path: ./coverage.xml
77+
junitxml-path: ./pytest.xml

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,4 @@ lint.extend-select = ["I"]
6868
[tool.pytest.ini_options]
6969
log_cli = true
7070
log_cli_level = "INFO"
71+
markers = ["cloud: Tests requiring cloud group dependencies"]

tests/test_indexing.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from pytest import LogCaptureFixture
1010

1111
import bids2table._indexing as indexing
12-
from bids2table._indexing import index_dataset
13-
from bids2table._pathlib import cloudpathlib_is_available
1412

1513
BIDS_EXAMPLES = Path(__file__).parents[1] / "bids-examples"
1614

@@ -55,9 +53,7 @@ def test_find_bids_datasets():
5553
assert datasets_no_derivatives == expected_datasets_no_derivatives
5654

5755

58-
@pytest.mark.skipif(
59-
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
60-
)
56+
@pytest.mark.cloud
6157
def test_find_bids_datasets_s3():
6258
root = "s3://openneuro.org"
6359
datasets = list(islice(indexing.find_bids_datasets(root, maxdepth=2), 10))
@@ -83,9 +79,7 @@ def test_index_dataset(root: str, expected_count: int):
8379
assert len(table) == expected_count
8480

8581

86-
@pytest.mark.skipif(
87-
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
88-
)
82+
@pytest.mark.cloud
8983
def test_index_dataset_s3():
9084
root = "s3://openneuro.org/ds000102"
9185
expected_count = 130
@@ -263,7 +257,7 @@ def test_index_dataset_accepts_schema_kwarg(tmp_path):
263257

264258
ns = deepcopy(bidsschematools.schema.load_schema())
265259
ns.objects.entities.subject["description"] = "Modified once"
266-
table = index_dataset(tmp_path / "ds", schema=ns, max_workers=0)
260+
table = indexing.index_dataset(tmp_path / "ds", schema=ns, max_workers=0)
267261
assert table.num_rows == 1
268262
assert "sub" in table.column_names
269263
assert table.schema.field("sub").metadata[b"description"] == b"Modified once"
@@ -281,22 +275,20 @@ def test_index_dataset_propagates_schema_to_workers(tmp_path):
281275

282276
ns = deepcopy(bidsschematools.schema.load_schema())
283277
ns.objects.entities.subject["description"] = "Modified again"
284-
table = index_dataset(tmp_path / "ds", schema=ns, max_workers=2, chunksize=1)
278+
table = indexing.index_dataset(tmp_path / "ds", schema=ns, max_workers=2, chunksize=1)
285279
assert table.num_rows == 1
286280
assert table.schema.field("sub").metadata[b"description"] == b"Modified again"
287281

288282

289283
def test_batch_index_dataset_accepts_schema_kwarg(tmp_path):
290-
from bids2table._indexing import batch_index_dataset
291-
292284
ds1 = tmp_path / "a"
293285
(ds1 / "sub-A01" / "anat").mkdir(parents=True)
294286
(ds1 / "dataset_description.json").write_text('{"Name": "a"}')
295287
(ds1 / "sub-A01" / "anat" / "sub-A01_T1w.nii.gz").touch()
296288

297289
ns = deepcopy(bidsschematools.schema.load_schema())
298290
ns.objects.entities.subject["description"] = "And again"
299-
tables = list(batch_index_dataset([ds1], schema=ns))
291+
tables = list(indexing.batch_index_dataset([ds1], schema=ns))
300292
assert len(tables) == 1
301293
assert tables[0].num_rows == 1
302294
assert tables[0].schema.field("sub").metadata[b"description"] == b"And again"

tests/test_metadata.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pytest
44

55
from bids2table._metadata import load_bids_metadata
6-
from bids2table._pathlib import cloudpathlib_is_available
76

87
BIDS_EXAMPLES = Path(__file__).parents[1] / "bids-examples"
98

@@ -24,9 +23,7 @@ def test_load_bids_metadata(inherit: bool):
2423
assert metadata == expected_metadata
2524

2625

27-
@pytest.mark.skipif(
28-
not cloudpathlib_is_available(), reason="cloudpathlib not installed"
29-
)
26+
@pytest.mark.cloud
3027
def test_load_bids_metadata_s3():
3128
path = (
3229
"s3://openneuro.org/ds000102/sub-01/func/sub-01_task-flanker_run-1_bold.nii.gz"

0 commit comments

Comments
 (0)