Skip to content

Commit 1a47c42

Browse files
committed
TST: Patch out netCDF4.Dataset in test (Fixes #1076)
netCDF4-python OPeNDAP support isn't captured by vcrpy, so this test was accessing the server on every run. This is failing a bunch lately, so patch out the call to Dataset() and just validate that it's used properly--we don't need to check OPeNDAP traffic end-to-end.
1 parent 96aa8f5 commit 1a47c42

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_catalog.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from datetime import datetime
77
import logging
8+
from unittest.mock import patch
89

910
import pytest
1011

@@ -416,4 +417,8 @@ def test_oceandata_hyrax_dataset():
416417
dap_url = cat.datasets[0].access_urls['opendap']
417418
assert dap_url == ('https://oceandata.sci.gsfc.nasa.gov/opendap/hyrax/SeaWiFS/L3SMI/2000/'
418419
'0101/SEASTAR_SEAWIFS_GAC.20000101.L3m.DAY.CHL.chlor_a.9km.nc')
419-
assert cat.datasets[0].remote_access()
420+
421+
# Traffic through netCDF4 isn't captured/stubbed by vcrpy
422+
with patch('netCDF4.Dataset') as mocked_dataset:
423+
assert cat.datasets[0].remote_access() is not None
424+
mocked_dataset.assert_called_once_with(dap_url)

0 commit comments

Comments
 (0)