Skip to content

Commit

Permalink
Merge pull request #521 from PCMDI/fix_test_suite_linux
Browse files Browse the repository at this point in the history
Fix test suite linux
  • Loading branch information
doutriaux1 committed Dec 21, 2017
2 parents 0e15d86 + 7b6a6ff commit 34e316e
Show file tree
Hide file tree
Showing 20 changed files with 408 additions and 357 deletions.
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,22 @@ language: python
sudo: false

before_install:
- export UVCDAT_FEATURE=""
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then curl -o miniconda.sh https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh ; fi
- export PATH="$HOME/miniconda/bin:$PATH"
- if [ ! -d ${HOME}/miniconda ]; then bash miniconda.sh -b -p $HOME/miniconda ; fi
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda install -f -q "conda<4.3.13"
- conda install --show-channel-urls --yes vcs vcsaddons mesalib cdp nose flake8 image-compare -c conda-forge -c uvcdat
# - conda install openssl=1.0.2d
- conda update -y -q conda

script:
- conda create -q -n py2 -c uvcdat/label/nightly -c conda-forge -c uvcdat vcs vcsaddons cdp mesalib image-compare flake8 nose
# Useful for debugging any issues with conda
- conda info -a

install:
- source activate py2
- python setup.py install

script:
- python run_tests.py -v2
- source activate py2
- python run_tests.py -v2

after_success:
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then conda install conda-build && conda install anaconda-client && bash -x recipes/pcmdi_metrics/conda_upload.sh; fi
22 changes: 11 additions & 11 deletions src/python/graphics/portraits.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ def rank(self, data, axis=0):
b = MV2.zeros(a0.shape, MV2.float)
sh = a0[1].shape
for i in range(n):
I = MV2.ones(sh) * i
Indx = MV2.ones(sh) * i
c = MV2.array(a0[i].filled(n - 1))
b = genutil.arrayindexing.set(b, c, I)
b = genutil.arrayindexing.set(b, c, Indx)

m = data.mask
if m is not None:
Expand Down Expand Up @@ -410,9 +410,9 @@ def rank_nD(self, data, axis=0):
b = MV2.zeros(a0.shape, MV2.float)
sh = a0[1].shape
for i in range(n):
I = MV2.ones(sh) * i
Indx = MV2.ones(sh) * i
c = MV2.array(a0[i].filled(n - 1))
b = genutil.arrayindexing.set(b, c, I)
b = genutil.arrayindexing.set(b, c, Indx)
m = data.mask
if m is not None:
b = MV2.masked_where(m, b)
Expand Down Expand Up @@ -595,7 +595,7 @@ def __get(self):
if sp1[j] == 'time_domain':
try:
v = int(v)
except:
except Exception:
pass
if v == 'NONE':
v = ''
Expand Down Expand Up @@ -641,7 +641,7 @@ def __get(self):
# In case sometihng goes wrong (like modle not processed or
# inexsitant for this var, etc...)
f.close()
except:
except Exception:
pass
output = MV2.reshape(output, (axes_length[0], axes_length[1]))
output.id = 'portrait plot'
Expand All @@ -665,7 +665,7 @@ def decorate(self, output, ynm=None, xnm=None):
del(x.name)
del(y.name)
del(output.name)
except:
except Exception:
pass

nm = '___'.join(xnm)
Expand Down Expand Up @@ -777,7 +777,7 @@ def plot(self, data=None, mesh=None, template=None,
template.legend.y2 = self.PLOT_SETTINGS.legend.y2
try:
tmp = x.createtextorientation('crap22')
except:
except Exception:
tmp = x.gettextorientation('crap22')
tmp.height = 12
# tmp.halign = 'center'
Expand Down Expand Up @@ -844,9 +844,9 @@ def plot(self, data=None, mesh=None, template=None,
# data=data
sh = list(data.shape)
sh.append(2)
I = MV2.indices((sh[0], sh[1]))
Y = I[0]
X = I[1]
Indx = MV2.indices((sh[0], sh[1]))
Y = Indx[0]
X = Indx[1]
# if ntot>1:
# meshfill.mesh='y'
if ntot == 1:
Expand Down
16 changes: 8 additions & 8 deletions src/python/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def update_dict(d, u):
def populate_prov(prov, cmd, pairs, sep=None, index=1, fill_missing=False):
try:
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except:
except Exception:
return
out, stde = p.communicate()
if stde != '':
Expand All @@ -66,14 +66,14 @@ def generateProvenance():
prov["platform"] = platfrm
try:
logname = os.getlogin()
except:
except Exception:
try:
import pwd
logname = pwd.getpwuid(os.getuid())[0]
except:
except Exception:
try:
logname = os.environ.get('LOGNAME', 'unknown')
except:
except Exception:
logname = 'unknown-loginname'
prov["userId"] = logname
prov["osAccess"] = bool(os.access('/', os.W_OK) * os.access('/', os.R_OK))
Expand Down Expand Up @@ -187,7 +187,7 @@ def write(self, data, type='json', *args, **kwargs):
if not os.path.exists(dir_path):
try:
os.makedirs(dir_path)
except:
except Exception:
logging.error(
'Could not create output directory: %s' % dir_path)

Expand Down Expand Up @@ -314,7 +314,7 @@ def set_file_mask_template(self):
def get_mask_from_var(self, var):
try:
o_mask = self.file_mask_template.get('sftlf')
except:
except Exception:
o_mask = cdutil.generateLandSeaMask(
var, regridTool=self.regrid_tool).filled(1.) * 100.
o_mask = MV2.array(o_mask)
Expand Down Expand Up @@ -463,11 +463,11 @@ def get_array_values_from_dict_recursive(self, out, ids, nms, axval, axes):
for k in axval:
try:
vals = vals[k]
except:
except Exception:
vals = 1.e20
try:
out[tuple(ids)] = float(vals)
except:
except Exception:
out[tuple(ids)] = 1.e20

def __init__(self, files=[], structure=[], ignored_keys=[], oneVariablePerFile=True):
Expand Down
10 changes: 5 additions & 5 deletions src/python/misc/scripts/install_metrics_from_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import shlex


l = time.localtime()
today = "%s.%s.%s" % (l.tm_year, l.tm_mon, l.tm_mday)
loc = time.localtime()
today = "%s.%s.%s" % (loc.tm_year, loc.tm_mon, loc.tm_mday)

P = argparse.ArgumentParser(
description='Merge many branches into a conda env',
Expand Down Expand Up @@ -50,9 +50,9 @@
default=["master"],
nargs="*",
help="cdms branches to merge")
l = P.add_argument_group('Local Setup')
l.add_argument("-g", "--git", default=os.path.expanduser("~/git"),
help="top directory where you will clone your git repos")
loc = P.add_argument_group('Local Setup')
loc.add_argument("-g", "--git", default=os.path.expanduser("~/git"),
help="top directory where you will clone your git repos")

args = P.parse_args(sys.argv[1:])

Expand Down
2 changes: 1 addition & 1 deletion src/python/pcmdi/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def addJson(self, filename):
# print filename,"K IS:",k
k.pop(k.index("source"))
out = out[k[0]] # first realization
except:
except Exception:
continue
# Ok at this point we need to see if it is json std 1 or 2
# version 1 had NHEX in every region
Expand Down
1 change: 0 additions & 1 deletion src/python/pcmdi/pmp_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ def __init__(self, warning=True, *args, **kwargs):
super(PMPParser, self).__init__(*args, **kwargs)
if warning:
print("Deprecation warning: please use 'import pcmdi_metrics.driver.pmp_parser.PMPParser'")

0 comments on commit 34e316e

Please sign in to comment.