Skip to content

Commit

Permalink
Fix warnings (#1571)
Browse files Browse the repository at this point in the history
* Fix warnings

* Make sure unittest CI runs test_mock

* Update changelog

* Cut number of tests run on CI
  • Loading branch information
rly authored Oct 19, 2022
1 parent d4dd8e2 commit 4f8f7eb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 31 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ jobs:
matrix:
include:
- { name: linux-python3.7-minimum , test-tox-env: py37-minimum , build-tox-env: build-py37-minimum , python-ver: "3.7" , os: ubuntu-latest }
- { name: linux-python3.10 , test-tox-env: py310 , build-tox-env: build-py310 , python-ver: "3.10", os: ubuntu-latest }
# NOTE config below with "upload-wheels: true" specifies that wheels should be uploaded as an artifact
- { name: linux-python3.10-upgraded , test-tox-env: py310-upgraded , build-tox-env: build-py310-upgraded , python-ver: "3.10", os: ubuntu-latest , upload-wheels: true }
- { name: windows-python3.7-minimum , test-tox-env: py37-minimum , build-tox-env: build-py37-minimum , python-ver: "3.7" , os: windows-latest }
- { name: windows-python3.10-upgraded , test-tox-env: py310-upgraded , build-tox-env: build-py310-upgraded , python-ver: "3.10", os: windows-latest }
- { name: macos-python3.7-minimum , test-tox-env: py37-minimum , build-tox-env: build-py37-minimum , python-ver: "3.7" , os: macos-latest }
- { name: macos-python3.10-upgraded , test-tox-env: py310-upgraded , build-tox-env: build-py310-upgraded , python-ver: "3.10", os: macos-latest }
steps:
- name: Cancel any previous incomplete runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -81,11 +78,11 @@ jobs:
matrix:
include:
- { name: linux-gallery-python3.7-minimum , test-tox-env: gallery-py37-minimum , python-ver: "3.7" , os: ubuntu-latest }
- { name: linux-gallery-python3.8-upgraded , test-tox-env: gallery-py38-upgraded, python-ver: "3.8", os: ubuntu-latest }
- { name: linux-gallery-python3.8-upgraded , test-tox-env: gallery-py38-upgraded , python-ver: "3.8" , os: ubuntu-latest }
# allensdk is not compatible with python 3.9+, so run gallery tests only on python <=3.8
# - { name: linux-gallery-python3.10-upgraded , test-tox-env: gallery-py310-upgraded, python-ver: "3.10", os: ubuntu-latest }
- { name: windows-gallery-python3.7-minimum , test-tox-env: gallery-py37-minimum , python-ver: "3.7" , os: windows-latest }
- { name: windows-gallery-python3.8-upgraded, test-tox-env: gallery-py38-upgraded, python-ver: "3.8", os: windows-latest }
- { name: windows-gallery-python3.8-upgraded , test-tox-env: gallery-py38-upgraded , python-ver: "3.8" , os: windows-latest }
# - { name: windows-gallery-python3.10-upgraded, test-tox-env: gallery-py310-upgraded, python-ver: "3.10", os: windows-latest }
steps:
- name: Cancel any previous incomplete runs
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
### Bug fixes
- Fixed bug in ``pynwb.testing.mock.file.mock_NWBFile`` to identifier UUID to string. @oruebel
[#1557](https://github.com/NeurodataWithoutBorders/pynwb/pull/1557)
- Minor fixes to test suite to prevent warnings. @rly
[#1571](https://github.com/NeurodataWithoutBorders/pynwb/pull/1571)

## PyNWB 2.1.1 (September 1, 2022)

Expand Down
5 changes: 4 additions & 1 deletion src/pynwb/testing/mock/ecephys.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def mock_ElectrodeTable(n_rows=5, group=None):

def mock_electrodes(n_electrodes=5, table=mock_ElectrodeTable(n_rows=5)):
return DynamicTableRegion(
"electrodes", list(range(n_electrodes)), "the first and third electrodes", table
name="electrodes",
data=list(range(n_electrodes)),
description="the first and third electrodes",
table=table,
)


Expand Down
3 changes: 2 additions & 1 deletion src/pynwb/testing/mock/file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from uuid import uuid4
from datetime import datetime
from dateutil.tz import tzlocal

from ...file import NWBFile, Subject
from .utils import name_generator
Expand All @@ -8,7 +9,7 @@
def mock_NWBFile(
session_description='session_description',
identifier=None,
session_start_time=datetime(1970, 1, 1),
session_start_time=datetime(1970, 1, 1, tzinfo=tzlocal()),
subject=None,
**kwargs
):
Expand Down
Binary file modified tests/back_compat/2.1.0_imageseries_no_data.nwb
Binary file not shown.
Binary file modified tests/back_compat/2.1.0_imageseries_non_external_format.nwb
Binary file not shown.
Binary file modified tests/back_compat/2.1.0_imageseries_nonmatch_starting_frame.nwb
Binary file not shown.
1 change: 1 addition & 0 deletions tests/back_compat/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_read(self):
for f in nwb_files:
with self.subTest(file=f.name):
with warnings.catch_warnings(record=True) as warnings_on_read:
warnings.simplefilter("always")
with NWBHDF5IO(str(f), 'r', load_namespaces=True) as io:
errors = validate(io)
io.read()
Expand Down
51 changes: 27 additions & 24 deletions tests/unit/test_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,33 @@
mock_SpikeEventSeries,
)

from pynwb.testing import TestCase
import pytest


@pytest.mark.parametrize(
"mock_function", [
mock_ImagingPlane,
mock_TwoPhotonSeries,
mock_RoiResponseSeries,
mock_PlaneSegmentation,
mock_OpticalChannel,
mock_OptogeneticStimulusSite,
mock_OptogeneticSeries,
mock_Device,
mock_Position,
mock_PupilTracking,
mock_CompassDirection,
mock_SpatialSeries,
mock_ElectrodeGroup,
mock_ElectrodeTable,
mock_ElectricalSeries,
mock_SpikeEventSeries,
mock_Subject,
mock_NWBFile,
],
)
def test_mock(mock_function):
mock_function()
class TestMock(TestCase):

@pytest.mark.parametrize(
"mock_function", [
mock_ImagingPlane,
mock_TwoPhotonSeries,
mock_RoiResponseSeries,
mock_PlaneSegmentation,
mock_OpticalChannel,
mock_OptogeneticStimulusSite,
mock_OptogeneticSeries,
mock_Device,
mock_Position,
mock_PupilTracking,
mock_CompassDirection,
mock_SpatialSeries,
mock_ElectrodeGroup,
mock_ElectrodeTable,
mock_ElectricalSeries,
mock_SpikeEventSeries,
mock_Subject,
mock_NWBFile,
],
)
def test_mock(mock_function):
mock_function()

0 comments on commit 4f8f7eb

Please sign in to comment.