Skip to content

Commit f9f4836

Browse files
committed
tests: Add missing timezone for NWB datetime entries
This avoids warnings. The additional dependency is already required by pynwb.
1 parent a55716f commit f9f4836

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pillow
1111
pyabf
1212
pynwb==3.1.2
1313
pyYAML
14+
python-dateutil
1415
ruamel.yaml<0.18.0
1516
scipy
1617
simplejson

tests/attach_metadata/test_cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import pytest
1515
from ipfx.utilities import inject_sweep_table
1616

17+
from dateutil.tz import tzlocal
18+
1719
class CliRunner:
1820

1921
def __init__(
@@ -54,7 +56,7 @@ def simple_nwb(base_path):
5456
nwbfile = pynwb.NWBFile(
5557
session_description="test session",
5658
identifier='test session',
57-
session_start_time=datetime.now()
59+
session_start_time=datetime.now(tzlocal())
5860
)
5961

6062
inject_sweep_table(nwbfile)

tests/attach_metadata/test_nwb2_sink.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import pynwb
1616
import h5py
1717

18+
from dateutil.tz import tzlocal
1819
from ipfx.attach_metadata.sink import nwb2_sink
1920
from ipfx.utilities import inject_sweep_table
2021

@@ -24,7 +25,7 @@ def nwbfile():
2425
_nwbfile = pynwb.NWBFile(
2526
session_description="test session",
2627
identifier='test session',
27-
session_start_time=datetime.now()
28+
session_start_time=datetime.now(tzlocal())
2829
)
2930
dev = pynwb.device.Device(name="my_device")
3031
_nwbfile.add_device(dev)

tests/dataset/test_ephys_nwb_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pynwb.icephys import CurrentClampStimulusSeries, CurrentClampSeries
88
import numpy as np
99
from ipfx.utilities import inject_sweep_table
10+
from dateutil.tz import tzlocal
1011

1112
from dictdiffer import diff
1213

@@ -28,8 +29,8 @@ def nwbfile_to_test():
2829
nwbfile = pynwb.NWBFile(
2930
session_description="test nwb data",
3031
identifier='test session',
31-
session_start_time=datetime.datetime.now(),
32-
file_create_date=datetime.datetime.now()
32+
session_start_time=datetime.datetime.now(tzlocal()),
33+
file_create_date=datetime.datetime.now(tzlocal())
3334
)
3435

3536
device = nwbfile.create_device(name='electrode_0')

tests/test_append_nwb.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import pynwb
44
import numpy as np
55

6+
from dateutil.tz import tzlocal
7+
68
from ipfx.nwb_append import append_spike_times
79

810

@@ -11,8 +13,8 @@ def make_skeleton_nwb2_file(nwb2_file_name):
1113
nwbfile = pynwb.NWBFile(
1214
session_description='test icephys',
1315
identifier='session_uuid',
14-
session_start_time=datetime.datetime.now(),
15-
file_create_date=datetime.datetime.now()
16+
session_start_time=datetime.datetime.now(tzlocal()),
17+
file_create_date=datetime.datetime.now(tzlocal())
1618
)
1719

1820
device = nwbfile.create_device(name='electrode_0')

0 commit comments

Comments
 (0)