bids-standard / bids-specification

Brain Imaging Data Structure (BIDS) Specification
https://bids-specification.readthedocs.io/
Creative Commons Attribution 4.0 International
276 stars 159 forks source link

[BUG] =bidsschematools-0.7.0 tests fail when run on the bundled test data #1500

Closed TheChymera closed 1 year ago

TheChymera commented 1 year ago

As seen in the Gentoo install sandbox (network-isolated so using bundled testdata): https://ppb.chymera.eu/f86ddd.log

Feedstock shows the same test breaking for the same reason: https://github.com/conda-forge/bidsschematools-feedstock/pull/2

After barking up a lot of wrong trees I figured out this is because our testdata generation does not include .bidsignore.

TheChymera commented 1 year ago

@yarikoptic @effigies

So I can confirm that for some reason the releases don't include .bidsignore files. I presume it's all of them, though data with .bidsignore was only introduced in =bidsschematools-0.7.0. However, the data copy creation maintains them, as seen below:

[deco]/tmp/bids-issue ❱ sha512sum bidsschematools-0.7.0.tar.gz
391e3ed1a96202bada1486de377ea4d96e8622cced132cbb014a697578dbd1c5fdfa3eb2ce6f44b5031136c987e2298a5bc702c1c5751e35479512cfe57a383b  bidsschematools-0.7.0.tar.gz
[deco]/tmp/bids-issue ❱ tar xvf bidsschematools-0.7.0.tar.gz &> /dev/null
[deco]/tmp/bids-issue ❱ ls /bidsschematools/tests/data/bids-examples/ds000248 -lah
ls: cannot access '/bidsschematools/tests/data/bids-examples/ds000248': No such file or directory
[deco]/tmp/bids-issue ❱ ls bidsschematools-0.7.0/bidsschematools/tests/data/bids-examples/ds000248 -lah
total 44K
drwxr-xr-x  5 chymera chymera 4.0K May 18 15:49 .
drwxr-xr-x 11 chymera chymera 4.0K May 18 15:49 ..
-rw-r--r--  1 chymera chymera  195 May 18 15:49 acq-epi_T1w.json
-rw-r--r--  1 chymera chymera  235 May 18 15:49 CHANGES
-rw-r--r--  1 chymera chymera 1.6K May 18 15:49 dataset_description.json
drwxr-xr-x  3 chymera chymera 4.0K May 18 15:49 derivatives
-rw-r--r--  1 chymera chymera  553 May 18 15:49 participants.json
-rw-r--r--  1 chymera chymera   75 May 18 15:49 participants.tsv
-rw-r--r--  1 chymera chymera 2.7K May 18 15:49 README
drwxr-xr-x  4 chymera chymera 4.0K May 18 15:49 sub-01
drwxr-xr-x  3 chymera chymera 4.0K May 18 15:49 sub-emptyroom
[deco]/tmp/bids-issue ❱ cd ~/src/bids-specification/tools/schemacode/
[deco]~/src/bids-specification/tools/schemacode ❱ BIDSSCHEMATOOLS_RELEASE=1 pytest -vvs
=========================================================== test session starts ============================================================
platform linux -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0 -- /usr/bin/python3.11
cachedir: .pytest_cache
rootdir: /home/chymera/src/bids-specification/tools/schemacode
configfile: pyproject.toml
plugins: mock-3.10.0, rerunfailures-11.1.2, pkgcore-0.12.21, pyfakefs-5.2.2
collected 58 items

bidsschematools/data/tests/test_rules.py::test_rule_objects PASSED
bidsschematools/data/tests/test_rules.py::test_entity_order Checking common.core
Checking common.tables
Checking deriv.imaging
Checking deriv.preprocessed_data
Checking raw.anat
Checking raw.beh
Checking raw.channels
Checking raw.dwi
Checking raw.eeg
Checking raw.fmap
Checking raw.func
Checking raw.ieeg
Checking raw.meg
Checking raw.micr
Checking raw.motion
Checking raw.nirs
Checking raw.perf
Checking raw.pet
Checking raw.photo
Checking raw.task
PASSED
bidsschematools/tests/test_expressions.py::test_schema_expressions PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[a*x**2 + b*x + c == 0-((((a * (x ** 2)) + (b * x)) + c) == 0)] PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[a.b.c[0][1][2].d(3, 4)-(((a.b).c)[0][1][2].d)(3, 4)] PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[nifti_header.pixdim[4] == sidecar.RepetitionTime-((nifti_header.pixdim)[4] == (sidecar.RepetitionTime))] PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[x.y * 10 ** (-3 * index(["a", "b", "c"], w.z))-((x.y) * (10 ** (-3 * index(['"a"', '"b"', '"c"'], (w.z)))))] PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[a && b && c || d || e && f-((a && (b && c)) || (d || (e && f)))] PASSED
bidsschematools/tests/test_expressions.py::test_expression_associations[! a && b || ! c == d || e-(((!a) && b) || ((!(c == d)) || e))] PASSED
bidsschematools/tests/test_expressions.py::test_selectors PASSED
bidsschematools/tests/test_expressions.py::test_checks PASSED
bidsschematools/tests/test_expressions.py::test_expected_failures[func(x, y] PASSED
bidsschematools/tests/test_expressions.py::test_expected_failures[lhs == ] PASSED
bidsschematools/tests/test_expressions.py::test_expected_failures[assignment = not.a.thing] PASSED
bidsschematools/tests/test_make_testdata.py::test_make_archive remote: Enumerating objects: 141, done.
remote: Counting objects: 100% (141/141), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 141 (delta 31), reused 121 (delta 30), pack-reused 0
Receiving objects: 100% (141/141), 369.26 KiB | 2.56 MiB/s, done.
Resolving deltas: 100% (31/31), done.
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 24 (delta 1), reused 20 (delta 1), pack-reused 0
Receiving objects: 100% (24/24), 343.22 KiB | 2.30 MiB/s, done.
Resolving deltas: 100% (1/1), done.
PASSED
bidsschematools/tests/test_render_tables.py::test_make_entity_table PASSED
bidsschematools/tests/test_render_tables.py::test_make_suffix_table PASSED
bidsschematools/tests/test_render_tables.py::test_make_sidecar_table PASSED
bidsschematools/tests/test_render_tables.py::test_make_metadata_table PASSED
bidsschematools/tests/test_render_tables.py::test_make_columns_table PASSED
bidsschematools/tests/test_render_text.py::test_make_entity_definitions PASSED
bidsschematools/tests/test_render_text.py::test_make_glossary PASSED
bidsschematools/tests/test_render_text.py::test_make_filename_template PASSED
bidsschematools/tests/test_render_text.py::test_define_common_principles PASSED
bidsschematools/tests/test_render_text.py::test_append_filename_template_legend PASSED
bidsschematools/tests/test_render_text.py::test_define_allowed_top_directories PASSED
bidsschematools/tests/test_render_utils.py::test_combine_extensions PASSED
bidsschematools/tests/test_render_utils.py::test_resolve_metadata_type PASSED
bidsschematools/tests/test_rules.py::test_entity_rule PASSED
bidsschematools/tests/test_rules.py::test_split_inheritance_rules PASSED
bidsschematools/tests/test_rules.py::test_stem_rule PASSED
bidsschematools/tests/test_rules.py::test_path_rule PASSED
bidsschematools/tests/test_rules.py::test_regexify_all PASSED
bidsschematools/tests/test_schema.py::test__get_bids_version PASSED
bidsschematools/tests/test_schema.py::test_load_schema PASSED
bidsschematools/tests/test_schema.py::test_object_definitions PASSED
bidsschematools/tests/test_schema.py::test_formats PASSED
bidsschematools/tests/test_schema.py::test_dereferencing PASSED
bidsschematools/tests/test_validator.py::test_inheritance_examples PASSED
bidsschematools/tests/test_validator.py::test_write_report PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[asl003] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[eeg_cbm] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[hcp_example_bids] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[micr_SEMzarr] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[micr_SPIM] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[pet003] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[qmri_tb1tfl] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[qmri_vfa] PASSED
bidsschematools/tests/test_validator.py::test_bids_datasets[ds000248] PASSED
bidsschematools/tests/test_validator.py::test_validate_bids PASSED
bidsschematools/tests/test_validator.py::test_broken_json_dataset PASSED
bidsschematools/tests/test_validator.py::test_exclude_files PASSED
bidsschematools/tests/test_validator.py::test_accept_non_bids_dir PASSED
bidsschematools/tests/test_validator.py::test_error_datasets[invalid_asl003] PASSED
bidsschematools/tests/test_validator.py::test_error_datasets[invalid_pet001] PASSED
bidsschematools/tests/test_validator.py::test_gitdir PASSED
bidsschematools/tests/test_validator.py::test_select_schema_path PASSED
bidsschematools/tests/test_validator.py::test_bids_schema_versioncheck PASSED

============================================================ 58 passed in 8.93s ============================================================
[deco]~/src/bids-specification/tools/schemacode ❱ ls bidsschematools/tests/data/bids-examples/ds000248/ -lah
total 48K
drwxr-xr-x  5 chymera chymera 4.0K May 23 23:03 .
drwx------ 11 chymera chymera 4.0K May 23 23:03 ..
-rw-r--r--  1 chymera chymera  195 May 23 23:03 acq-epi_T1w.json
-rw-r--r--  1 chymera chymera   22 May 23 23:03 .bidsignore
-rw-r--r--  1 chymera chymera  235 May 23 23:03 CHANGES
-rw-r--r--  1 chymera chymera 1.6K May 23 23:03 dataset_description.json
drwxr-xr-x  3 chymera chymera 4.0K May 23 23:03 derivatives
-rw-r--r--  1 chymera chymera  553 May 23 23:03 participants.json
-rw-r--r--  1 chymera chymera   75 May 23 23:03 participants.tsv
-rw-r--r--  1 chymera chymera 2.7K May 23 23:03 README
drwxr-xr-x  4 chymera chymera 4.0K May 23 23:03 sub-01
drwxr-xr-x  3 chymera chymera 4.0K May 23 23:03 sub-emptyroom

I am less sure where this gets ignored. I assume that this line doesn't expand to include hidden files.

effigies commented 1 year ago

Why not try adding **/.bidsignore?

I would also be curious about better ways to package these data files.

TheChymera commented 1 year ago

@effigies yep, that's what I was trying out in the mean time. PR here https://github.com/bids-standard/bids-specification/pull/1502