Skip to content

Commit 8172b0a

Browse files
Fixing tests.
1 parent 5ea11ce commit 8172b0a

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

pylossless/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def pipeline_fixture():
1919
"""Return a namedTuple containing MNE eyetracking raw data and events."""
2020
raw, config, bids_path = load_openneuro_bids()
21-
raw.crop(tmin=0, tmax=60) # take 60 seconds for speed
21+
# raw.crop(tmin=0, tmax=60) # Too short for ICA to converge in some tests.
2222
annots = Annotations(
2323
onset=[1, 15], duration=[1, 1], description=["test_annot", "test_annot"]
2424
)
@@ -28,6 +28,7 @@ def pipeline_fixture():
2828
config["find_breaks"]["min_break_duration"] = 9
2929
config["find_breaks"]["t_start_after_previous"] = 1
3030
config["find_breaks"]["t_stop_before_next"] = 0
31+
config["ica"]["ica_args"]["run1"]["max_iter"] = 5000
3132
config.save("test_config.yaml")
3233
pipeline = ll.LosslessPipeline("test_config.yaml")
3334
not_in_1020 = ["EXG1", "EXG2", "EXG3", "EXG4", "EXG5", "EXG6", "EXG7", "EXG8"]

pylossless/datasets/datasets.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def load_openneuro_bids(subject="pd6"):
3333
openneuro = ll.utils.import_optional_dependency("openneuro")
3434

3535
config = ll.config.Config()
36-
config.load_default()
36+
# TODO: Tests were developed using this configuration. The adult version
37+
# should probably be used instead, but this change will require fixing the
38+
# tests accordingly.
39+
config.load_default("infants")
3740
config["project"]["bids_montage"] = ""
3841
config["project"]["analysis_montage"] = "standard_1020"
3942
config["project"]["set_montage_kwargs"]["on_missing"] = "warn"

pylossless/tests/test_utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ def test_import_optional_dependency():
55
from pylossless.utils import check
66

77
# Test the case where the package is not installed.
8-
with pytest.raises(ImportError, match="Missing optional dependency 'astropy'."):
9-
# choosing a package that will probably never be added to the requirements!
10-
check.import_optional_dependency("astropy")
8+
package = "sdgssfersfsdesdfsefsdfsdt"
9+
with pytest.raises(ImportError, match=f"Missing optional dependency '{package}'."):
10+
# Choosing a package that will probably never be added to the requirements!
11+
# We also choose a name of a package that is likely not to exist at all
12+
# to avoid the corresponding package is installed in the development
13+
# environment of developpers.
14+
check.import_optional_dependency(package)
1115

1216
# Test the case where the package is installed.
1317
mne = check.import_optional_dependency("mne", raise_error=False)
1418
assert mne is not None
1519

1620
# Test the where case package is not installed but we don't want to raise an error.
17-
astropy = check.import_optional_dependency("astropy", raise_error=False)
18-
assert astropy is None
21+
ret_val = check.import_optional_dependency(package, raise_error=False)
22+
assert ret_val is None

0 commit comments

Comments
 (0)