diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 0a1a5e0a5..14bd909db 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -208,7 +208,6 @@ jobs: if: matrix.bids-validator-version == 'validator-stable' run: | npm install -g bids-validator - echo "BIDS_VALIDATOR_BRANCH=stable" >> $GITHUB_ENV - name: Download BIDS validator (main) if: matrix.bids-validator-version == 'validator-main' @@ -216,13 +215,11 @@ jobs: pushd .. git clone --depth 1 https://github.com/bids-standard/bids-validator popd - echo "BIDS_VALIDATOR_BRANCH=main" >> $GITHUB_ENV - name: Install BIDS validator (main) if: matrix.bids-validator-version == 'validator-main' run: | - pushd .. - cd bids-validator + pushd ../bids-validator # Generate the full development node_modules npm install # Build & bundle the bids-validator CLI package @@ -230,7 +227,7 @@ jobs: # Generate a package to install globally npm -w bids-validator pack # Install the package globally - bash -c "npm install -g bids-validator-*.tgz" + npm install -g bids-validator-*.tgz popd - name: Display versions and environment information diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9161db60..412dee07e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -153,13 +153,6 @@ you can then simply use the following command from the root of the `mne-bids` re make test ``` -If you have installed the `bids-validator` on a per-user basis (that is, *not* globally), -set the environment variable `VALIDATOR_EXECUTABLE` to point to the path of the `bids-validator` before invoking `pytest`: - -```Shell -VALIDATOR_EXECUTABLE=../bids-validator/bids-validator/bin/bids-validator pytest -``` - ## Building the documentation The documentation can be built using [Sphinx](https://www.sphinx-doc.org). diff --git a/mne_bids/tests/conftest.py b/mne_bids/tests/conftest.py index 675e82fa2..fa1889af5 100644 --- a/mne_bids/tests/conftest.py +++ b/mne_bids/tests/conftest.py @@ -3,36 +3,24 @@ # Authors: The MNE-BIDS developers # SPDX-License-Identifier: BSD-3-Clause -import os import platform import pytest from mne.utils import run_subprocess -# WINDOWS issues: -# the bids-validator development version does not work properly on Windows as -# of 2019-06-25 --> https://github.com/bids-standard/bids-validator/issues/790 -# As a workaround, we try to get the path to the executable from an environment -# variable VALIDATOR_EXECUTABLE ... if this is not possible we assume to be -# using the stable bids-validator and make a direct call of bids-validator -# also: for windows, shell = True is needed to call npm, bids-validator etc. -# see: https://stackoverflow.com/q/28891053/5201771 @pytest.fixture(scope="session") def _bids_validate(): """Fixture to run BIDS validator.""" - vadlidator_args = ["--config.error=41"] - exe = os.getenv("VALIDATOR_EXECUTABLE", "bids-validator") - + # See: https://stackoverflow.com/q/28891053/5201771 + # On Windows, shell must be True if platform.system() == "Windows": shell = True else: shell = False - bids_validator_exe = [exe, *vadlidator_args] - def _validate(bids_root): - cmd = [*bids_validator_exe, bids_root] + cmd = ["bids-validator", bids_root] run_subprocess(cmd, shell=shell) return _validate diff --git a/mne_bids/tests/test_report.py b/mne_bids/tests/test_report.py index dfe7ff59d..94434bda8 100644 --- a/mne_bids/tests/test_report.py +++ b/mne_bids/tests/test_report.py @@ -45,7 +45,8 @@ def test_report(tmp_path): report = make_report(bids_root) - expected_report = f"""This dataset was created by [Unspecified] and conforms to BIDS version {BIDS_VERSION}. + expected_report = f""" The [Unspecified] dataset was created by [Unspecified1], and [Unspecified2] and +conforms to BIDS version {BIDS_VERSION}. This report was generated with MNE-BIDS (https://doi.org/10.21105/joss.01896). The dataset consists of 1 participants (sex were all unknown; handedness were all unknown; ages all unknown) and 1 recording sessions: 01. Data was recorded @@ -79,7 +80,8 @@ def test_report_no_participant_information(tmp_path): report = make_report(bids_root) - expected_report = f"""This dataset was created by [Unspecified] and conforms to BIDS version {BIDS_VERSION}. + expected_report = f""" The [Unspecified] dataset was created by [Unspecified1], and [Unspecified2] and +conforms to BIDS version {BIDS_VERSION}. This report was generated with MNE-BIDS (https://doi.org/10.21105/joss.01896). The dataset consists of 1 participants (sex were all unknown; handedness were all unknown; ages all unknown) and 1 recording sessions: 01. Data was recorded diff --git a/mne_bids/tests/test_write.py b/mne_bids/tests/test_write.py index 2f2c2bb61..c9c2a18eb 100644 --- a/mne_bids/tests/test_write.py +++ b/mne_bids/tests/test_write.py @@ -350,7 +350,10 @@ def test_make_dataset_description(tmp_path, monkeypatch): with open(op.join(tmp_path, "dataset_description.json"), encoding="utf-8") as fid: dataset_description_json = json.load(fid) - assert dataset_description_json["Authors"] == ["[Unspecified]"] + assert dataset_description_json["Authors"] == [ + "[Unspecified1]", + "[Unspecified2]", + ] make_dataset_description( path=tmp_path, @@ -365,7 +368,10 @@ def test_make_dataset_description(tmp_path, monkeypatch): with open(op.join(tmp_path, "dataset_description.json"), encoding="utf-8") as fid: dataset_description_json = json.load(fid) - assert dataset_description_json["Authors"] == ["[Unspecified]"] + assert dataset_description_json["Authors"] == [ + "[Unspecified1]", + "[Unspecified2]", + ] make_dataset_description( path=tmp_path, diff --git a/mne_bids/write.py b/mne_bids/write.py index 05b335154..3399f21a9 100644 --- a/mne_bids/write.py +++ b/mne_bids/write.py @@ -1386,7 +1386,7 @@ def make_dataset_description( # if the user passed an author don't overwrite, # if there was an author there, only overwrite if `overwrite=True` if authors is None and (description["Authors"] is None or overwrite): - description["Authors"] = ["[Unspecified]"] + description["Authors"] = ["[Unspecified1]", "[Unspecified2]"] # Only write data that is not None pop_keys = [key for key, val in description.items() if val is None] @@ -2055,7 +2055,7 @@ def write_raw_bids( # already exist. Always set overwrite to False here. If users # want to edit their dataset_description, they can directly call # this function. - make_dataset_description(path=bids_path.root, name=" ", overwrite=False) + make_dataset_description(path=bids_path.root, name="[Unspecified]", overwrite=False) _sidecar_json( raw,