diff --git a/.travis.yml b/.travis.yml index a1c4e8b1..92b71135 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,8 @@ language: python python: - "2.7" - - "3.4" - "3.5" + - "3.6" notifications: email: false install: diff --git a/deps_py2.txt b/deps_py2.txt index b3e57986..c3fd83c7 100644 --- a/deps_py2.txt +++ b/deps_py2.txt @@ -6,7 +6,6 @@ basemap netcdf4 h5py bottle -Pydap lxml python-dateutil mock diff --git a/deps_py3.txt b/deps_py3.txt index d2d43c39..c845e065 100644 --- a/deps_py3.txt +++ b/deps_py3.txt @@ -4,6 +4,7 @@ scipy matplotlib basemap netcdf4 +Pydap h5py bottle python-dateutil diff --git a/ocw/dataset_loader.py b/ocw/dataset_loader.py index f84bdc40..f5f04fc4 100644 --- a/ocw/dataset_loader.py +++ b/ocw/dataset_loader.py @@ -96,16 +96,22 @@ def __init__(self, *loader_opts): 'podaac': podaac.extract_l4_granule } - # Exclude esgf and dap for python 3 until they are compatible + # Exclude esgf for python > 2.7.x. until it is compatible try: import ocw.data_source.esgf as esgf - import ocw.data_source.dap as dap - self._source_loaders['dap'] = dap.load self._source_loaders['esgf'] = esgf.load_dataset except ImportError: - warnings.warn('dap and esgf loaders missing. If these are needed, ' + warnings.warn('esgf loader missing. If this is needed, ' 'fallback to python 2.7.x.') + # Exclude dap for python < 3.5 until it is compatible + try: + import ocw.data_source.dap as dap + self._source_loaders['dap'] = dap.load + except ImportError: + warnings.warn('dap loaders missing. If this is needed, ' + 'upgrade to python >=3.5.x.') + def add_source_loader(self, loader_name, loader_func): ''' Add a custom source loader. diff --git a/ocw/tests/test_dap.py b/ocw/tests/test_dap.py index 20910bfe..e873915b 100644 --- a/ocw/tests/test_dap.py +++ b/ocw/tests/test_dap.py @@ -17,10 +17,14 @@ import unittest import datetime as dt -import ocw.data_source.dap as dap +try: + import ocw.data_source.dap as dap +except ImportError: + warnings.warn('dap loaders missing. If this is needed, upgrade to python >=3.5.x.') +import platform from ocw.dataset import Dataset - +@unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") class TestDap(unittest.TestCase): @classmethod @@ -49,25 +53,32 @@ def setUpClass(cls): cls.name2 = 'foo2' cls.dataset2 = dap.load(cls.url2, 'scale_factor', name=cls.name)''' + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_dataset_is_returned(self): self.assertTrue(isinstance(self.dataset, Dataset)) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_correct_lat_shape(self): self.assertEquals(len(self.dataset.lats), 29) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_correct_lon_shape(self): self.assertEquals(len(self.dataset.lons), 26) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_correct_time_shape(self): self.assertEquals(len(self.dataset.times), 1) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_valid_date_conversion(self): start = dt.datetime(2006, 6, 7, 12) self.assertTrue(start == self.dataset.times[0]) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_custom_dataset_name(self): self.assertEquals(self.dataset.name, self.name) + @unittest.skipIf(platform.python_version() < (3.5), "Pydap not supported in Python < 3.5") def test_dataset_origin(self): self.assertEquals(self.dataset.origin['source'], 'dap') self.assertEquals(self.dataset.origin['url'], self.url) diff --git a/ocw/tests/test_podaac.py b/ocw/tests/test_podaac.py index 6c600ab3..e607323f 100644 --- a/ocw/tests/test_podaac.py +++ b/ocw/tests/test_podaac.py @@ -22,7 +22,7 @@ import datetime as dt from ocw.dataset import Dataset - +@unittest.skip("CLIMATE-959 Remove ocw.tests.test_podaac.TestPodaacDataSource from tests until service is more reliable") class TestPodaacDataSource(unittest.TestCase): @classmethod