climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From good...@apache.org
Subject climate git commit: CLIMATE-882 - local data source is not Python 3 compatible
Date Fri, 21 Oct 2016 00:31:38 GMT
Repository: climate
Updated Branches:
  refs/heads/master fc520781d -> 8cf223f2c


CLIMATE-882 - local data source is not Python 3 compatible


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/8cf223f2
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/8cf223f2
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/8cf223f2

Branch: refs/heads/master
Commit: 8cf223f2c704fe0f3e27bfe2288ccfd11324fd68
Parents: fc52078
Author: Alex Goodman <agoodm@users.noreply.github.com>
Authored: Thu Oct 20 15:25:24 2016 -0700
Committer: Alex Goodman <agoodm@users.noreply.github.com>
Committed: Thu Oct 20 16:48:26 2016 -0700

----------------------------------------------------------------------
 .travis.yml              |  3 ---
 ocw/data_source/local.py | 10 +++++-----
 test.sh                  |  5 +++--
 3 files changed, 8 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/8cf223f2/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 1a50d8b..9cac19c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -44,9 +44,6 @@ install:
   # Add conda-forge to search so all dependencies can be resolved
   - conda config --add channels conda-forge
   - conda create -q -n test-environment nose python=$TRAVIS_PYTHON_VERSION --file $DEPS
-
-  # Need this to exclude pydap test for python 3
-  - pip install nose-exclude
   
   # Install ocw
   - source activate test-environment

http://git-wip-us.apache.org/repos/asf/climate/blob/8cf223f2/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index ce57538..626dee5 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -31,9 +31,9 @@ import h5py
 import numpy
 import numpy.ma as ma
 
-LAT_NAMES = ['y', 'rlat', 'rlats', 'lat', 'lats', 'latitude', 'latitudes']
-LON_NAMES = ['x', 'rlon', 'rlons', 'lon', 'lons', 'longitude', 'longitudes']
-TIME_NAMES = ['time', 'times', 'date', 'dates', 'julian']
+LAT_NAMES = [b'y', b'rlat', b'rlats', b'lat', b'lats', b'latitude', b'latitudes']
+LON_NAMES = [b'x', b'rlon', b'rlons', b'lon', b'lons', b'longitude', b'longitudes']
+TIME_NAMES = [b'time', b'times', b'date', b'dates', b'julian']
 
 
 def _get_netcdf_variable_name(valid_var_names, netcdf, netcdf_var):
@@ -78,7 +78,7 @@ def _get_netcdf_variable_name(valid_var_names, netcdf, netcdf_var):
         # earlier. If the dimension's name matches then that variable is
         # potentially what we want to return to the user.
         possible_vars = []
-        for var in netcdf.variables.keys():
+        for var in list(netcdf.variables.keys()):
             var_dimensions = netcdf.variables[var].dimensions
 
             # Skip any dimensions are > 1D
@@ -96,7 +96,7 @@ def _get_netcdf_variable_name(valid_var_names, netcdf, netcdf_var):
             return possible_vars[0]
 
     # Check for valid variable names in netCDF variable names
-    variables = netcdf.variables.keys()
+    variables = list(netcdf.variables.keys())
     vars_lower = [var.encode().lower() for var in variables]
 
     intersect = set(valid_var_names).intersection(vars_lower)

http://git-wip-us.apache.org/repos/asf/climate/blob/8cf223f2/test.sh
----------------------------------------------------------------------
diff --git a/test.sh b/test.sh
index cc73d04..70ea0a2 100755
--- a/test.sh
+++ b/test.sh
@@ -26,10 +26,11 @@ echo ""
 cp .noserc $HOME/.noserc
 
 # Exclude dap tests if using python 3
+NOSE_FLAGS=''
 if [[ "$1" != "2.7" ]]; then
-  export NOSE_EXCLUDE_TESTS=ocw.tests.test_dap.TestDap
+  NOSE_FLAGS='-I test_dap'
 fi
 
 echo "---------------- Running Unit Tests ---------------"
-nosetests
+nosetests $NOSE_FLAGS
 echo "---------------- All Tests successfully completed ---------------"


Mime
View raw message