From a755d9e8058d410d458e0cbff67bc473a0fde954 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:20:49 -0400 Subject: [PATCH 01/21] MAINT: Cleaner testing --- .github/workflows/linux.yml | 36 +++++++------------ .github/workflows/macos.yml | 19 ++++------ Makefile | 3 -- mne_realtime/conftest.py | 6 ++++ mne_realtime/tests/test_fieldtrip_client.py | 4 ++- mne_realtime/tests/test_lsl_client.py | 26 +++++++------- mne_realtime/tests/test_stim_client_server.py | 3 +- requirements.txt | 1 - setup.py | 5 +-- 9 files changed, 44 insertions(+), 59 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 61faf84..5fc5a07 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,40 +14,28 @@ on: jobs: job: - name: 'py3.10' + name: 'py3.11' runs-on: ubuntu-20.04 defaults: run: - shell: bash + shell: bash -el {0} steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' name: 'Setup python' - - shell: bash -el {0} - run: | + - run: | wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh source ./tools/get_minimal_commands.sh name: 'Install neuromag2ft' - - shell: bash -el {0} - run: neuromag2ft --version - name: 'Test neuromag2ft' - - shell: bash -el {0} - run: ./tools/pip_dependencies.sh - name: 'Install MNE-Realtime' - - shell: bash -el {0} - run: pip install --upgrade git+https://github.com/mne-tools/mne-python.git - name: 'Install latest MNE' - - shell: bash -el {0} - run: mne sys_info - name: Print config - - shell: bash -el {0} - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" + - run: neuromag2ft --version + - run: ./tools/pip_dependencies.sh + - run: pip install --upgrade git+https://github.com/mne-tools/mne-python.git + - run: mne sys_info + - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: 'Get test data' - - shell: bash -el {0} - run: pytest mne_realtime - name: 'Run tests' + - run: pytest -vv mne_realtime - uses: codecov/codecov-action@v1 if: success() name: 'Upload coverage to CodeCov' diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a4fe3e5..343018e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,9 +18,9 @@ jobs: runs-on: macos-latest defaults: run: - shell: bash + shell: bash -el {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: conda-incubator/setup-miniconda@v2 with: python-version: '3.8' @@ -28,18 +28,11 @@ jobs: environment-file: 'environment.yml' activate-environment: 'mne_realtime' name: 'Setup conda' - - shell: bash -el {0} - run: ./tools/pip_dependencies.sh - name: 'Install MNE-Realtime' - - shell: bash -el {0} - run: mne sys_info - name: Print config - - shell: bash -el {0} - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" + - run: ./tools/pip_dependencies.sh + - run: mne sys_info + - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: 'Get test data' - - shell: bash -el {0} - run: pytest mne_realtime - name: 'Run tests' + - run: pytest mne_realtime - uses: codecov/codecov-action@v1 if: success() name: 'Upload coverage to CodeCov' diff --git a/Makefile b/Makefile index 5056bbd..d8004b6 100644 --- a/Makefile +++ b/Makefile @@ -45,9 +45,6 @@ test-full: in rm -f .coverage $(PYTESTS) mne -test-no-network: in - sudo unshare -n -- sh -c 'MNE_SKIP_NETWORK_TESTS=1 py.test mne' - test-no-testing-data: in @MNE_SKIP_TESTING_DATASET_TESTS=true \ $(PYTESTS) mne diff --git a/mne_realtime/conftest.py b/mne_realtime/conftest.py index 4803045..b6f4f3d 100644 --- a/mne_realtime/conftest.py +++ b/mne_realtime/conftest.py @@ -13,6 +13,12 @@ def pytest_configure(config): for fixture in ('matplotlib_config',): config.addinivalue_line('usefixtures', fixture) + # Marks + for marker in ( + "network_test", + ): + config.addinivalue_line("markers", marker) + # Warnings # - Once SciPy updates not to have non-integer and non-tuple errors (1.2.0) # we should remove them from here. diff --git a/mne_realtime/tests/test_fieldtrip_client.py b/mne_realtime/tests/test_fieldtrip_client.py index aed0b0a..836e4d3 100644 --- a/mne_realtime/tests/test_fieldtrip_client.py +++ b/mne_realtime/tests/test_fieldtrip_client.py @@ -20,13 +20,15 @@ from mne.io import read_raw_fif from mne.utils import requires_neuromag2ft from mne_realtime import FieldTripClient, RtEpochs - from mne_realtime.tests.test_mock_client import _call_base_epochs_public_api base_dir = op.join(op.dirname(__file__), '..', '..', 'mne_realtime', 'tests', 'data') raw_fname = op.realpath(op.join(base_dir, 'test_raw.fif')) +if 'NEUROMAG2FT_ROOT' not in os.environ: + pytest.skip("NEUROMAG2FT_ROOT env var not found") + @pytest.fixture def free_tcp_port(): diff --git a/mne_realtime/tests/test_lsl_client.py b/mne_realtime/tests/test_lsl_client.py index fd9e7e7..5588196 100644 --- a/mne_realtime/tests/test_lsl_client.py +++ b/mne_realtime/tests/test_lsl_client.py @@ -6,7 +6,6 @@ import time import pytest -from mne.utils import requires_pylsl from mne.io import read_raw_fif from mne.datasets import testing import numpy as np @@ -20,10 +19,10 @@ raw_fname = op.join(base_dir, 'test_raw.fif') -@requires_pylsl @testing.requires_testing_data def test_lsl_client(): """Test the LSLClient for connection and data retrieval.""" + pytest.importorskip('pylsl') raw = read_raw_fif(raw_fname) raw_info = raw.info sfreq = raw_info['sfreq'] @@ -47,10 +46,10 @@ def test_lsl_client(): assert raw_info['nchan'], sfreq == epoch.get_data().shape[1:] -@requires_pylsl @testing.requires_testing_data def test_lsl_client_nodata(): """Test that LSLClient gracefully handles no-data from LSL.""" + pytest.importorskip('pylsl') raw = read_raw_fif(raw_fname) raw_info = raw.info with MockLSLStream(host, raw, ch_type='eeg', status=True): @@ -58,11 +57,11 @@ def test_lsl_client_nodata(): epoch = client.get_data_as_epoch(n_samples=0, timeout=0) assert epoch is None -@requires_pylsl -def test_connect(mocker): + +def test_connect(monkeypatch): """Mock connect to LSL stream.""" # Import pylsl here so that the test can be skipped if pylsl is not installed - pylsl = _check_pylsl_installed(strict=True) + pylsl = pytest.importorskip("pylsl") # Constants buffer_size = 17 @@ -71,15 +70,16 @@ def test_connect(mocker): numpy_channel_format = np.float32 # Replace pylsl streams with a mock - mock_resolve_streams = mocker.patch( + monkeypatch.setattr( 'pylsl.resolve_streams', - return_value=[pylsl.StreamInfo( - source_id=host, - channel_count=n_channels, - channel_format=c_channel_format, - )], + lambda *args, **kwargs: [ + pylsl.StreamInfo( + source_id=host, + channel_count=n_channels, + channel_format=c_channel_format, + ) + ], ) - lsl_client = LSLClient(host=host, buffer_size=buffer_size) # Mock out the pylsl.resolve_streams lsl_client._connect() diff --git a/mne_realtime/tests/test_stim_client_server.py b/mne_realtime/tests/test_stim_client_server.py index 138367f..91b0c6d 100644 --- a/mne_realtime/tests/test_stim_client_server.py +++ b/mne_realtime/tests/test_stim_client_server.py @@ -3,7 +3,6 @@ import time import pytest -from mne.utils import requires_good_network from mne_realtime import StimServer, StimClient @@ -12,7 +11,7 @@ _max_wait = 10. -@requires_good_network +@pytest.mark.network_test def test_connection(): """Test TCP/IP connection for StimServer <-> StimClient.""" global _server, _have_put_in_trigger diff --git a/requirements.txt b/requirements.txt index e0f098e..ef58b47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,6 @@ sip scikit-learn pytest pytest-cov -pytest-mock numpydoc pydocstyle flake8 diff --git a/setup.py b/setup.py index 4212c85..471d1cd 100644 --- a/setup.py +++ b/setup.py @@ -32,9 +32,10 @@ 'Operating System :: POSIX', 'Operating System :: Unix', 'Operating System :: MacOS', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ] EXTRAS_REQUIRE = { 'tests': [ @@ -65,6 +66,6 @@ zip_safe=False, # the package can run out of an .egg file classifiers=CLASSIFIERS, packages=find_packages(), - python_requires='>=3.7', + python_requires='>=3.8', install_requires=INSTALL_REQUIRES, extras_require=EXTRAS_REQUIRE) From 5b91153b482c002eaf80ce39d1880afdbd06a0cf Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:33:45 -0400 Subject: [PATCH 02/21] FIX: Simplify --- .github/workflows/linux.yml | 27 ++++++++++++------ .github/workflows/macos.yml | 38 ------------------------- azure-pipelines.yml | 55 ------------------------------------- tools/pip_dependencies.sh | 6 ---- 4 files changed, 18 insertions(+), 108 deletions(-) delete mode 100644 .github/workflows/macos.yml delete mode 100644 azure-pipelines.yml delete mode 100755 tools/pip_dependencies.sh diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5fc5a07..bb1ba4d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: 'linux / pip' +name: 'test' concurrency: group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} cancel-in-progress: true @@ -9,13 +9,19 @@ on: pull_request: branches: - '*' - schedule: - - cron: "0 4 * * 0" jobs: job: - name: 'py3.11' - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + kind: [pip] + python: ['3.11'] + include: + - os: macos-latest + kind: mamba + python: '3.8' defaults: run: shell: bash -el {0} @@ -23,15 +29,18 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.11' - name: 'Setup python' + python-version: ${{ matrix.python }} + if: ${{ matrix.kind == 'pip' }} - run: | wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh source ./tools/get_minimal_commands.sh + if: ${{ ! startswith(matrix.os, 'windows') }} name: 'Install neuromag2ft' - run: neuromag2ft --version - - run: ./tools/pip_dependencies.sh - - run: pip install --upgrade git+https://github.com/mne-tools/mne-python.git + if: ${{ ! startswith(matrix.os, 'windows') }} + - run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install -r requirements.txt git+https://github.com/mne-tools/mne-python -ve . - run: mne sys_info - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: 'Get test data' diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index 343018e..0000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: 'macos / conda' -concurrency: - group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} - cancel-in-progress: true -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - schedule: - - cron: "0 4 * * 0" - -jobs: - job: - name: 'py3.8' - runs-on: macos-latest - defaults: - run: - shell: bash -el {0} - steps: - - uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v2 - with: - python-version: '3.8' - auto-update-conda: true - environment-file: 'environment.yml' - activate-environment: 'mne_realtime' - name: 'Setup conda' - - run: ./tools/pip_dependencies.sh - - run: mne sys_info - - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" - name: 'Get test data' - - run: pytest mne_realtime - - uses: codecov/codecov-action@v1 - if: success() - name: 'Upload coverage to CodeCov' diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index fb72929..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,55 +0,0 @@ -trigger: - # start a new build for every push - batch: False - branches: - include: - - main - - maint/* - -jobs: -- job: Windows - pool: - vmIMage: 'windows-latest' - variables: - MNE_LOGGING_LEVEL: 'warning' - MNE_FORCE_SERIAL: 'true' - OPENBLAS_NUM_THREADS: 1 - AZURE_CI_WINDOWS: 'true' - strategy: - maxParallel: 4 - matrix: - Python39-64bit-full-pip: - PYTHON_VERSION: '3.9' - PYTHON_ARCH: 'x64' - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: $(PYTHON_VERSION) - architecture: $(PYTHON_ARCH) - addToPath: true - condition: eq(variables['TEST_MODE'], 'pip') - - powershell: | - Set-StrictMode -Version Latest - $ErrorActionPreference = "Stop" - $PSDefaultParameterValues['*:ErrorAction']='Stop' - pip install --upgrade --pre numpy scipy matplotlib - pip install https://api.github.com/repos/mne-tools/mne-python/zipball/main - pip install --upgrade -r requirements.txt - pip install pylsl - displayName: 'Install dependencies with pip' - - script: python setup.py develop - displayName: 'Install MNE-Realtime' - - script: python -c "import mne; print(mne.sys_info())" - displayName: 'Print config' - - script: python -c "import mne; mne.datasets.testing.data_path(verbose=True)" - displayName: 'Get test data' - - script: pytest mne_realtime - displayName: 'Run tests' - - bash: bash <(curl -s https://codecov.io/bash) - displayName: 'Codecov' - condition: succeededOrFailed() - - task: PublishTestResults@2 - inputs: - testResultsFiles: 'junit-*.xml' - testRunTitle: 'Publish test results for Python $(python.version)' - condition: always() diff --git a/tools/pip_dependencies.sh b/tools/pip_dependencies.sh deleted file mode 100755 index dd4775d..0000000 --- a/tools/pip_dependencies.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -ef - -python -m pip install --upgrade pip -python -m pip install --upgrade setuptools wheel -python -m pip install -r requirements.txt -python -m pip install -ve . From 057ee823eaae1d5b140344b6bcd926f75920d7ee Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:33:59 -0400 Subject: [PATCH 03/21] MAINT: Move --- .github/workflows/{linux.yml => test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{linux.yml => test.yml} (100%) diff --git a/.github/workflows/linux.yml b/.github/workflows/test.yml similarity index 100% rename from .github/workflows/linux.yml rename to .github/workflows/test.yml From 90f332e8871729bcc0902d49860db5f8f178dceb Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:35:15 -0400 Subject: [PATCH 04/21] FIX: Better --- .github/workflows/{test.yml => tests.yml} | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) rename .github/workflows/{test.yml => tests.yml} (65%) diff --git a/.github/workflows/test.yml b/.github/workflows/tests.yml similarity index 65% rename from .github/workflows/test.yml rename to .github/workflows/tests.yml index bb1ba4d..f0d744c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/tests.yml @@ -31,13 +31,22 @@ jobs: with: python-version: ${{ matrix.python }} if: ${{ matrix.kind == 'pip' }} + - uses: conda-incubator/setup-miniconda@v2 + with: + python-version: ${{ env.PYTHON_VERSION }} + environment-file: ${{ env.CONDA_ENV }} + activate-environment: mne + miniforge-version: latest + miniforge-variant: Mambaforge + use-mamba: ${{ matrix.kind != 'conda' }} + if: ${{ !startswith(matrix.kind, 'pip') }} - run: | - wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh - source ./tools/get_minimal_commands.sh - if: ${{ ! startswith(matrix.os, 'windows') }} + wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh + source ./tools/get_minimal_commands.sh + if: ${{ !startswith(matrix.os, 'windows') }} name: 'Install neuromag2ft' - run: neuromag2ft --version - if: ${{ ! startswith(matrix.os, 'windows') }} + if: ${{ !startswith(matrix.os, 'windows') }} - run: | python -m pip install --upgrade pip setuptools wheel python -m pip install -r requirements.txt git+https://github.com/mne-tools/mne-python -ve . From f5c8fceec75b2f6e72a0976f92004f642c375de4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:36:24 -0400 Subject: [PATCH 05/21] FIX: Name --- .github/workflows/circle_artifacts.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/circle_artifacts.yml b/.github/workflows/circle_artifacts.yml index b4b246e..e1910ef 100644 --- a/.github/workflows/circle_artifacts.yml +++ b/.github/workflows/circle_artifacts.yml @@ -8,5 +8,7 @@ jobs: uses: larsoner/circleci-artifacts-redirector-action@master with: repo-token: ${{ secrets.GITHUB_TOKEN }} + api-token: ${{ secrets.CIRCLECI_TOKEN }} artifact-path: 0/dev/index.html circleci-jobs: build_docs + job-title: Check the rendered docs here! From 741f5cb4bf2ca5b8cfc48339919ba321c3f822ef Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:37:12 -0400 Subject: [PATCH 06/21] FIX: Dir --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b360056..ec9a82a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -27,6 +27,7 @@ jobs: echo "set -e" >> $BASH_ENV echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV + mkdir -p tools wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh source tools/get_minimal_commands.sh echo "export MNE_3D_BACKEND=pyvistaqt" >> $BASH_ENV From 2f80607702d15d15953f9659a25f9826a8957480 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 31 Jul 2023 17:37:43 -0400 Subject: [PATCH 07/21] FIX: Unify --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ec9a82a..b60d9f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,8 +72,7 @@ jobs: name: Install dependencies and mne-realtime command: | python -m pip install --upgrade --progress-bar off pip setuptools wheel - python -m pip install --upgrade --progress-bar off -r requirements.txt git+https://github.com/mne-tools/mne-python@main - python -m pip install -e .[docs] git+https://github.com/sphinx-gallery/sphinx-gallery@master + python -m pip install --upgrade --progress-bar off -r requirements.txt git+https://github.com/mne-tools/mne-python@main -e .[docs] git+https://github.com/sphinx-gallery/sphinx-gallery@master - save_cache: key: pip-cache-1 From f27daf6c48fbc3bd6230c40887cceaabf3853445 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 11:07:55 -0400 Subject: [PATCH 08/21] FIX: Tests --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f0d744c..50cbbe6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,6 +13,7 @@ on: jobs: job: runs-on: ${{ matrix.os }} + continue-on-error: true strategy: matrix: os: [ubuntu-latest, windows-latest] @@ -41,6 +42,7 @@ jobs: use-mamba: ${{ matrix.kind != 'conda' }} if: ${{ !startswith(matrix.kind, 'pip') }} - run: | + mkdir -p tools wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh source ./tools/get_minimal_commands.sh if: ${{ !startswith(matrix.os, 'windows') }} From f83b8c022fa410eaade80cee618003cd51575a89 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 11:16:20 -0400 Subject: [PATCH 09/21] FIX: Fixes --- .github/workflows/tests.yml | 2 ++ mne_realtime/tests/test_fieldtrip_client.py | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50cbbe6..5f1316f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,6 +23,8 @@ jobs: - os: macos-latest kind: mamba python: '3.8' + env: + CI_OS_NAME: ${{ matrix.os }} defaults: run: shell: bash -el {0} diff --git a/mne_realtime/tests/test_fieldtrip_client.py b/mne_realtime/tests/test_fieldtrip_client.py index 836e4d3..1443b24 100644 --- a/mne_realtime/tests/test_fieldtrip_client.py +++ b/mne_realtime/tests/test_fieldtrip_client.py @@ -18,7 +18,6 @@ from mne import Epochs, find_events, pick_types from mne.io import read_raw_fif -from mne.utils import requires_neuromag2ft from mne_realtime import FieldTripClient, RtEpochs from mne_realtime.tests.test_mock_client import _call_base_epochs_public_api @@ -27,7 +26,7 @@ raw_fname = op.realpath(op.join(base_dir, 'test_raw.fif')) if 'NEUROMAG2FT_ROOT' not in os.environ: - pytest.skip("NEUROMAG2FT_ROOT env var not found") + pytest.skip("NEUROMAG2FT_ROOT env var not found", allow_module_level=True) @pytest.fixture @@ -69,7 +68,6 @@ def _start_buffer_thread(buffer_port): return signal_queue -@requires_neuromag2ft def test_fieldtrip_rtepochs(free_tcp_port, tmpdir): """Test FieldTrip RtEpochs.""" raw_tmax = 7 @@ -127,7 +125,6 @@ def test_fieldtrip_rtepochs(free_tcp_port, tmpdir): kill_signal.put(False) # stop the buffer -@requires_neuromag2ft def test_fieldtrip_client(free_tcp_port): """Test fieldtrip_client.""" kill_signal = _start_buffer_thread(free_tcp_port) From 86e7bdba439b87ad1195a20d89938155d7d7fac2 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 11:48:06 -0400 Subject: [PATCH 10/21] FIX: Better --- .github/workflows/tests.yml | 17 ++++++++--------- environment.yml | 8 +++----- mne_realtime/tests/test_mock_client.py | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f1316f..704cdb8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,7 +21,7 @@ jobs: python: ['3.11'] include: - os: macos-latest - kind: mamba + kind: conda python: '3.8' env: CI_OS_NAME: ${{ matrix.os }} @@ -34,15 +34,11 @@ jobs: with: python-version: ${{ matrix.python }} if: ${{ matrix.kind == 'pip' }} - - uses: conda-incubator/setup-miniconda@v2 + - uses: mamba-org/setup-micromamba@v2 with: - python-version: ${{ env.PYTHON_VERSION }} - environment-file: ${{ env.CONDA_ENV }} - activate-environment: mne - miniforge-version: latest - miniforge-variant: Mambaforge - use-mamba: ${{ matrix.kind != 'conda' }} - if: ${{ !startswith(matrix.kind, 'pip') }} + environment-file: environment.yml + create-args: python=${{ matrix.python }} + if: ${{ matrix.kind == 'conda' }} - run: | mkdir -p tools wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh @@ -51,6 +47,9 @@ jobs: name: 'Install neuromag2ft' - run: neuromag2ft --version if: ${{ !startswith(matrix.os, 'windows') }} + - run: curl https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb | dpkg -i + if: ${{ startswith(matrix.os, 'ubuntu') }} + name: Install liblsl on Linux - run: | python -m pip install --upgrade pip setuptools wheel python -m pip install -r requirements.txt git+https://github.com/mne-tools/mne-python -ve . diff --git a/environment.yml b/environment.yml index 38cf612..5f426ca 100644 --- a/environment.yml +++ b/environment.yml @@ -14,8 +14,6 @@ dependencies: - pytest-cov - numpydoc - flake8 -- pip: - - mne>=1.0.0 - - pydocstyle - - codespell - - pylsl>=1.12 +- pylsl +- mne +- pydocstyle diff --git a/mne_realtime/tests/test_mock_client.py b/mne_realtime/tests/test_mock_client.py index dfe438d..17fbe5e 100644 --- a/mne_realtime/tests/test_mock_client.py +++ b/mne_realtime/tests/test_mock_client.py @@ -59,7 +59,7 @@ def _call_base_epochs_public_api(epochs, tmpdir): epochs.tmax epochs.filename repr(epochs) - epochs.plot(show=False) + epochs.plot(show=False, events=True) # save time by not calling all plot functions # epochs.plot_psd(show=False) # epochs.plot_drop_log(show=False) From 84f3456227f2dc2eb4770fdaa781786b5c5dbf0b Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:12:02 -0400 Subject: [PATCH 11/21] FIX: Linux --- .github/workflows/tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 704cdb8..f8722b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,13 +40,11 @@ jobs: create-args: python=${{ matrix.python }} if: ${{ matrix.kind == 'conda' }} - run: | - mkdir -p tools - wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh - source ./tools/get_minimal_commands.sh - if: ${{ !startswith(matrix.os, 'windows') }} - name: 'Install neuromag2ft' - - run: neuromag2ft --version - if: ${{ !startswith(matrix.os, 'windows') }} + mkdir -p tools + wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh + source ./tools/get_minimal_commands.sh + neuromag2ft --version + if: ${{ startswith(matrix.os, 'ubuntu') }} - run: curl https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb | dpkg -i if: ${{ startswith(matrix.os, 'ubuntu') }} name: Install liblsl on Linux From 299bbd15ce58f30c4ba8f40b6b9471a28d41e81f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:12:44 -0400 Subject: [PATCH 12/21] FIX: mamab --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f8722b9..cca6273 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,7 +34,7 @@ jobs: with: python-version: ${{ matrix.python }} if: ${{ matrix.kind == 'pip' }} - - uses: mamba-org/setup-micromamba@v2 + - uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml create-args: python=${{ matrix.python }} From b84bc95aebc56815aa1f33323cdaca4704bc8ad3 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:15:10 -0400 Subject: [PATCH 13/21] FIX: Install --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cca6273..b0b0b9c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,7 +45,9 @@ jobs: source ./tools/get_minimal_commands.sh neuromag2ft --version if: ${{ startswith(matrix.os, 'ubuntu') }} - - run: curl https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb | dpkg -i + - run: | + wget -q https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb + sudo dpkg -i liblsl-*.deb if: ${{ startswith(matrix.os, 'ubuntu') }} name: Install liblsl on Linux - run: | From 4ad722ed1b47be4a32df629235f393ad7b84df7f Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:17:59 -0400 Subject: [PATCH 14/21] FIX: Dep --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b0b0b9c..c245631 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: 'test' +name: 'Tests' concurrency: group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }} cancel-in-progress: true @@ -11,7 +11,7 @@ on: - '*' jobs: - job: + pytest: runs-on: ${{ matrix.os }} continue-on-error: true strategy: @@ -47,7 +47,7 @@ jobs: if: ${{ startswith(matrix.os, 'ubuntu') }} - run: | wget -q https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb - sudo dpkg -i liblsl-*.deb + sudo apt install ./liblsl-*.deb if: ${{ startswith(matrix.os, 'ubuntu') }} name: Install liblsl on Linux - run: | From bc7fee29edd46ae3fd7cae02d387d02f35953d14 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:19:21 -0400 Subject: [PATCH 15/21] FIX: Name --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c245631..f6f0898 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,12 +44,13 @@ jobs: wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh source ./tools/get_minimal_commands.sh neuromag2ft --version + name: Install neuromag2ft if: ${{ startswith(matrix.os, 'ubuntu') }} - run: | wget -q https://github.com/sccn/liblsl/releases/download/v1.16.2/liblsl-1.16.2-jammy_amd64.deb sudo apt install ./liblsl-*.deb if: ${{ startswith(matrix.os, 'ubuntu') }} - name: Install liblsl on Linux + name: Install liblsl - run: | python -m pip install --upgrade pip setuptools wheel python -m pip install -r requirements.txt git+https://github.com/mne-tools/mne-python -ve . From 21da6b16ca7298493e403b8c2a07469630e788c2 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:24:10 -0400 Subject: [PATCH 16/21] FIX: Main --- .github/workflows/tests.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f6f0898..a4544cf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -40,9 +40,8 @@ jobs: create-args: python=${{ matrix.python }} if: ${{ matrix.kind == 'conda' }} - run: | - mkdir -p tools - wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh - source ./tools/get_minimal_commands.sh + git clone --single-branch -b main https://github.com/mne-tools/mne-python.git + source ./mne-python/tools/get_minimal_commands.sh neuromag2ft --version name: Install neuromag2ft if: ${{ startswith(matrix.os, 'ubuntu') }} @@ -53,10 +52,15 @@ jobs: name: Install liblsl - run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install -r requirements.txt git+https://github.com/mne-tools/mne-python -ve . + python -m pip install -r requirements.txt -ve . -e ./mne-python - run: mne sys_info + - run: ./mne-python/tools/get_testing_version.sh - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: 'Get test data' + - uses: actions/cache@v3 + with: + key: ${{ env.TESTING_VERSION }} + path: ~/mne_data - run: pytest -vv mne_realtime - uses: codecov/codecov-action@v1 if: success() From 67c7d238328733dbaed9d1a522e0f42187f67fc4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:25:07 -0400 Subject: [PATCH 17/21] FIX: macOS --- environment.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 5f426ca..555b47d 100644 --- a/environment.yml +++ b/environment.yml @@ -14,6 +14,8 @@ dependencies: - pytest-cov - numpydoc - flake8 -- pylsl +- liblsl - mne - pydocstyle +pip: + - pylsl From 9c2dbc1c89eaa3539ae9663121732be3828d1045 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:25:49 -0400 Subject: [PATCH 18/21] FIX: Pip --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 555b47d..1f4faf5 100644 --- a/environment.yml +++ b/environment.yml @@ -17,5 +17,5 @@ dependencies: - liblsl - mne - pydocstyle -pip: +- pip: - pylsl From 698af471745e3441cb325dda42ab41312097b7a4 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:28:46 -0400 Subject: [PATCH 19/21] FIX: Test --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4544cf..8f38591 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,8 +39,9 @@ jobs: environment-file: environment.yml create-args: python=${{ matrix.python }} if: ${{ matrix.kind == 'conda' }} + - run: git clone --single-branch -b main https://github.com/mne-tools/mne-python.git + name: Clone MNE-Python - run: | - git clone --single-branch -b main https://github.com/mne-tools/mne-python.git source ./mne-python/tools/get_minimal_commands.sh neuromag2ft --version name: Install neuromag2ft @@ -53,10 +54,11 @@ jobs: - run: | python -m pip install --upgrade pip setuptools wheel python -m pip install -r requirements.txt -ve . -e ./mne-python + name: Install dependencies and MNE-Realtime - run: mne sys_info - run: ./mne-python/tools/get_testing_version.sh - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" - name: 'Get test data' + name: Get test data - uses: actions/cache@v3 with: key: ${{ env.TESTING_VERSION }} From c560a80fc175de2f7c664514cef3624197eca516 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:30:02 -0400 Subject: [PATCH 20/21] FIX: Dir --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f38591..a20b4dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -56,7 +56,8 @@ jobs: python -m pip install -r requirements.txt -ve . -e ./mne-python name: Install dependencies and MNE-Realtime - run: mne sys_info - - run: ./mne-python/tools/get_testing_version.sh + - run: ./tools/get_testing_version.sh + working-directory: mne-python - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: Get test data - uses: actions/cache@v3 From 2a755c642ef263322abfacad589f7cc9f4d958e2 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 1 Aug 2023 12:30:57 -0400 Subject: [PATCH 21/21] FIX: Rel --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a20b4dd..841dd5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,7 +57,7 @@ jobs: name: Install dependencies and MNE-Realtime - run: mne sys_info - run: ./tools/get_testing_version.sh - working-directory: mne-python + working-directory: ./mne-python - run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))" name: Get test data - uses: actions/cache@v3