Skip to content

MAINT: Work around pytest issue #12377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- packaging
- numba
- pandas
- pyarrow
- xlrd
- scikit-learn
- h5py
Expand Down
4 changes: 1 addition & 3 deletions mne/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,9 +1616,7 @@ def events_from_annotations(
inds = values = np.array([]).astype(int)
for annot in annotations[event_sel]:
annot_offset = annot["onset"] + annot["duration"]
_onsets = np.arange(
start=annot["onset"], stop=annot_offset, step=chunk_duration
)
_onsets = np.arange(annot["onset"], annot_offset, chunk_duration)
good_events = annot_offset - _onsets >= chunk_duration
if good_events.any():
_onsets = _onsets[good_events]
Expand Down
4 changes: 4 additions & 0 deletions mne/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def pytest_configure(config):
ignore:ast\.NameConstant is deprecated and will be removed in Python 3\.14.*:DeprecationWarning
# pooch
ignore:Python 3\.14 will, by default, filter extracted tar archives.*:DeprecationWarning
# pandas
ignore:\n*Pyarrow will become a required dependency of pandas.*:DeprecationWarning
# pyvista <-> NumPy 2.0
ignore:__array_wrap__ must accept context and return_scalar arguments.*:DeprecationWarning
""" # noqa: E501
for warning_line in warning_lines.split("\n"):
warning_line = warning_line.strip()
Expand Down
6 changes: 6 additions & 0 deletions mne/io/fiff/tests/test_raw_fiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import pathlib
import pickle
import platform
import shutil
import sys
from copy import deepcopy
Expand Down Expand Up @@ -42,6 +43,7 @@
assert_and_remove_boundary_annot,
assert_object_equal,
catch_logging,
check_version,
requires_mne,
run_subprocess,
)
Expand Down Expand Up @@ -1023,6 +1025,8 @@ def test_proj(tmp_path):
@pytest.mark.parametrize("preload", [False, True, "memmap.dat"])
def test_preload_modify(preload, tmp_path):
"""Test preloading and modifying data."""
if platform.system() == "Windows" and check_version("numpy", "2.0.0dev"):
pytest.skip("Problem on Windows, see numpy/issues/25665")
rng = np.random.RandomState(0)
raw = read_raw_fif(fif_fname, preload=preload)

Expand Down Expand Up @@ -1926,6 +1930,8 @@ def test_equalize_channels():
def test_memmap(tmp_path):
"""Test some interesting memmapping cases."""
# concatenate_raw
if platform.system() == "Windows" and check_version("numpy", "2.0.0dev"):
pytest.skip("Problem on Windows, see numpy/issues/25665")
memmaps = [str(tmp_path / str(ii)) for ii in range(3)]
raw_0 = read_raw_fif(test_fif_fname, preload=memmaps[0])
assert raw_0._data.filename == memmaps[0]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ full = [
"numba",
"h5py",
"pandas",
"pyarrow", # only needed to avoid a deprecation warning in pandas
"numexpr",
"jupyter",
"python-picard",
Expand Down Expand Up @@ -109,7 +110,7 @@ full = [

# Dependencies for running the test infrastructure
test = [
"pytest!=8.0.0rc1",
"pytest!=8.0.0rc1,!=8.0.0rc2",
"pytest-cov",
"pytest-timeout",
"pytest-harvest",
Expand Down
7 changes: 1 addition & 6 deletions tools/azure_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ elif [ "${TEST_MODE}" == "pip-pre" ]; then
STD_ARGS="$STD_ARGS --pre"
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://www.riverbankcomputing.com/pypi/simple" "PyQt6!=6.6.1" PyQt6-sip PyQt6-Qt6 "PyQt6-Qt6!=6.6.1"
echo "Numpy etc."
# See github_actions_dependencies.sh for comments
# Until https://github.com/scipy/scipy/issues/19605 and
# https://github.com/scipy/scipy/issues/19713 are resolved, we can't use the NumPy
# 2.0 wheels :(
python -m pip install $STD_ARGS --only-binary numpy scipy h5py
python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" scikit-learn matplotlib statsmodels
python -m pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" "scipy>=1.12.0.dev0" "scikit-learn>=1.5.dev0" matplotlib pillow statsmodels pyarrow
# echo "dipy"
# python -m pip install $STD_ARGS --only-binary ":all:" --extra-index-url "https://pypi.anaconda.org/scipy-wheels-nightly/simple" dipy
# echo "OpenMEEG"
Expand Down
2 changes: 1 addition & 1 deletion tools/github_actions_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else
echo "PyQt6"
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url https://www.riverbankcomputing.com/pypi/simple "PyQt6!=6.6.1" "PyQt6-Qt6!=6.6.1"
echo "NumPy/SciPy/pandas etc."
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" "scipy>=1.12.0.dev0" "scikit-learn==1.4.dev0" matplotlib pillow statsmodels
pip install $STD_ARGS --only-binary ":all:" --default-timeout=60 --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" "numpy>=2.0.0.dev0" "scipy>=1.12.0.dev0" "scikit-learn>=1.5.dev0" matplotlib pillow statsmodels pyarrow
# No pandas, dipy, h5py, openmeeg, python-picard (needs numexpr) until they update to NumPy 2.0 compat
INSTALL_KIND="test_extra"
# echo "dipy"
Expand Down