diff --git a/_setup_utils.py b/_setup_utils.py index 484615915..377b58193 100644 --- a/_setup_utils.py +++ b/_setup_utils.py @@ -41,6 +41,12 @@ SASS_FILES = glob.glob(os.path.join('share', 'sass', '[!_]*.scss')) + ( glob.glob(os.path.join('bootstrap-ligo', 'css', '[!_]*.scss'))) +# make sure submodule is not empty +static = glob.glob(os.path.join('bootstrap-ligo', '*')) +if not static: + raise ValueError('bootstrap-ligo submodule is empty, please populate it ' + 'with `git submodule update --init`') + # -- custom commands ---------------------------------------------------------- diff --git a/gwdetchar/io/tests/test_datafind.py b/gwdetchar/io/tests/test_datafind.py index 07e8838a5..f00509336 100644 --- a/gwdetchar/io/tests/test_datafind.py +++ b/gwdetchar/io/tests/test_datafind.py @@ -19,9 +19,6 @@ """Tests for `gwdetchar.io.datafind` """ -import os -import shutil - import pytest import numpy @@ -86,35 +83,31 @@ def test_get_data_dict_from_NDS(tsdfetch): nptest.assert_array_equal(data['X1:TEST-STRAIN'].value, HOFT.value) -def test_get_data_from_cache(tmpdir): - # set up a data file - os.chdir(str(tmpdir)) - HOFT.write('test.gwf') - +@mock.patch('gwpy.timeseries.TimeSeries.read', + return_value=HOFT.crop(16, 48)) +def test_get_data_from_cache(tsfetch): # retrieve test frame start = 16 end = start + 32 channel = 'X1:TEST-STRAIN' - data = datafind.get_data(channel, start, end, source='test.gwf') + data = datafind.get_data(channel, start, end, source=True) # test data products assert isinstance(data, TimeSeries) assert data.duration.value == 32 assert data.span == Segment(start, end) nptest.assert_array_equal(data.value, HOFT.crop(start, end).value) - shutil.rmtree(str(tmpdir), ignore_errors=True) - -def test_get_data_dict_from_cache(tmpdir): - # set up a data file - os.chdir(str(tmpdir)) - HOFT.write('test.gwf') +@mock.patch('gwpy.timeseries.TimeSeriesDict.read', + return_value=TimeSeriesDict({ + 'X1:TEST-STRAIN': HOFT.crop(16, 48)})) +def test_get_data_dict_from_cache(tsdfetch): # retrieve test frame start = 16 end = start + 32 channels = ['X1:TEST-STRAIN'] - data = datafind.get_data(channels, start, end, source='test.gwf') + data = datafind.get_data(channels, start, end, source=True) # test data products assert isinstance(data, TimeSeriesDict) @@ -122,4 +115,3 @@ def test_get_data_dict_from_cache(tmpdir): assert data[channels[0]].span == Segment(start, end) nptest.assert_array_equal(data[channels[0]].value, HOFT.crop(start, end).value) - shutil.rmtree(str(tmpdir), ignore_errors=True)