Skip to content
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

Skip ros3 tests if internet or ros3 driver are not available #1414

Merged
merged 3 commits into from
Oct 5, 2021
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Bug fixes:
- Add `environment-ros3.yml` to `MANIFEST.in` for inclusion in source distributions. @rly (#1398)
- Fix bad error check in ``IntracellularRecordingsTable.add_recording`` when adding ``IZeroClampSeries``. @oruebel (#1410)
- Skip ros3 tests if internet access or the ros3 driver are not available. @oruebel (#1414)

### Tutorial enhancements:
- Updated the general tutorial to add documentation about the ``Images`` type. @bendichter (#1353)
Expand Down
17 changes: 15 additions & 2 deletions tests/integration/ros3/test_ros3.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
from pynwb import NWBHDF5IO
from pynwb.testing import TestCase
import urllib.request
import h5py


class TestRos3Streaming(TestCase):
# requires h5py to be built with the ROS3 driver: conda install -c conda-forge h5py
"""
Test file access using the HDF5 ros3 driver.

This test module requires h5py to be built with the ROS3 driver: conda install -c conda-forge h5py
"""
def setUp(self):
# Skip ROS3 tests if internet is not available or the ROS3 driver is not installed
try:
urllib.request.urlopen('https://dandiarchive.s3.amazonaws.com/ros3test.nwb', timeout=1)
except urllib.request.URLError:
self.skipTest("Internet access to DANDI failed. Skipping all Ros3 streaming tests.")
if 'ros3' not in h5py.registered_drivers():
self.skipTest("ROS3 driver not installed. Skipping all Ros3 streaming tests.")

def test_read(self):
s3_path = 'https://dandiarchive.s3.amazonaws.com/ros3test.nwb'

with NWBHDF5IO(s3_path, mode='r', driver='ros3') as io:
nwbfile = io.read()
test_data = nwbfile.acquisition['ts_name'].data[:]
Expand Down