Skip to content

Commit

Permalink
Evaluate numpy test results
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Nov 17, 2020
1 parent a7b4b62 commit 0f2b047
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion easybuild/easyblocks/n/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ def __init__(self, *args, **kwargs):
self.sitecfg = None
self.sitecfgfn = 'site.cfg'
self.testinstall = True
self.testcmd = "cd .. && %(python)s -c 'import numpy; numpy.test(verbose=2)'"
if LooseVersion(self.version) >= LooseVersion('1.15'):
# Numpy 1.15+ returns a True on success. Hence invert to get a failure value
test_code = 'sys.exit(!numpy.test(verbose=2))'
else:
# Return value is a TextTestResult. Check the errors member for any error
test_code = 'sys.exit(len(numpy.test(verbose=2).errors) > 0)'
# Prepend imports
test_code = "import sys; import numpy; " + test_code
# LDFLAGS should not be set when testing numpy/scipy, because it overwrites whatever numpy/scipy sets
# see http://projects.scipy.org/numpy/ticket/182
self.testcmd = "unset LDFLAGS && cd .. && %%(python)s -c '%s'" % test_code

def configure_step(self):
"""Configure numpy build by composing site.cfg contents."""
Expand Down

0 comments on commit 0f2b047

Please sign in to comment.