Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

CLIMATE-958 Disable Pydap for Python 2 build, activate for Python 3 build #516

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions ocw/dataset_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ 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
self._source_loaders['esgf'] = esgf.load_dataset
except ImportError:
warnings.warn('esgf loader missing. If this is needed, '
'fallback to python 2.7.x.')

# Exclude esgf and dap for python 3 until they are compatible
# 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.4.x.')
'upgrade to python >=3.5.x.')

def add_source_loader(self, loader_name, loader_func):
'''
Expand Down
7 changes: 5 additions & 2 deletions ocw/tests/test_dap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good @lewismc 🎆
This will probably solve the problem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests that need such skipping, let me know about it. I can work on it then

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
Expand Down
2 changes: 1 addition & 1 deletion ocw/tests/test_podaac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down