From: Jean-Philippe ARGAUD Date: Mon, 22 Feb 2016 21:21:03 +0000 (+0100) Subject: Updating one salome test X-Git-Tag: V7_8_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a472714beb092fc08d9ca1e94c0e985ea6e5f89f;p=modules%2Fadao.git Updating one salome test --- diff --git a/test/test1001/CTestTestfile.cmake b/test/test1001/CTestTestfile.cmake index 1a209cb..25860dd 100644 --- a/test/test1001/CTestTestfile.cmake +++ b/test/test1001/CTestTestfile.cmake @@ -1,4 +1,6 @@ -# Copyright (C) 2015 CEA/DEN, EDF R&D +# Copyright (C) 2008-2016 EDF R&D +# +# This file is part of SALOME ADAO module # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,7 +22,7 @@ #FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py") SET(TEST_NAMES - HelloWorld + Versions ) FOREACH(tfile ${TEST_NAMES}) diff --git a/test/test1001/HelloWorld.py b/test/test1001/HelloWorld.py deleted file mode 100644 index c90c6a5..0000000 --- a/test/test1001/HelloWorld.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python - -print "Hello world!" diff --git a/test/test1001/Versions.py b/test/test1001/Versions.py new file mode 100644 index 0000000..b405012 --- /dev/null +++ b/test/test1001/Versions.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python +#-*-coding:iso-8859-1-*- +"""Test des versions de modules""" + +minimal_python_version = "2.7.10" +minimal_numpy_version = "1.9.2" +minimal_scipy_version = "0.15.0" +minimal_matplotlib_version = "1.4.3" + +def compare_versions(v1,v2): + "Comparaison v1 >= v2" + v11,v12,v13 = map(float,v1.split('.')) + v21,v22,v23 = map(float,v2.split('.')) + lv1 = 1e6*v11 + 1e3*v12 + v13 + lv2 = 1e6*v21 + 1e3*v22 + v23 + return lv1 >= lv2 + +def minimalVersion(): + "Description" + print " Les versions minimales attendues sont :" + print " - Python systeme....: %s"%minimal_python_version + print " - Numpy.............: %s"%minimal_numpy_version + print " - Scipy.............: %s"%minimal_scipy_version + print " - Matplotlib........: %s"%minimal_matplotlib_version + print + +import sys +def testSysteme(): + "Test des versions de modules" + print " Les versions disponibles sont :" + v=sys.version.split() + print " - Python systeme....: %s"%v[0] + assert compare_versions(sys.version.split()[0], minimal_python_version) + # + try: + import numpy + print " - Numpy.............: %s"%numpy.version.version + assert compare_versions(numpy.version.version, minimal_numpy_version) + except ImportError: + return 1 + # + try: + import scipy + print " - Scipy.............: %s"%scipy.version.version + assert compare_versions(scipy.version.version, minimal_scipy_version) + except ImportError: + return 1 + # + try: + import matplotlib + mplversion = matplotlib.__version__ + print " - Matplotlib........: %s"%mplversion + assert compare_versions(mplversion, minimal_matplotlib_version) + # + print + backends_OK = [] + backends_KO = [] + backend_now = matplotlib.get_backend() + + for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps', + 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', + 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', + 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']: + try: + matplotlib.use(backend) + backends_OK.append(backend) + except ValueError: + backends_KO.append(backend) + # + print " Backends disponibles pour Matplotlib %s :"%mplversion + print " Defaut initial......: '%s'"%backend_now + print " Fonctionnant........:" + for b in backends_OK: + print " '%s'"%b + print " Non fonctionnant....:" + for b in backends_KO: + print " '%s'"%b + print " (Le backend 'bidon' n'est ici que pour verifier le test, il n'existe pas)" + except ImportError: + pass + print + # + return 0 + +#=============================================================================== +if __name__ == "__main__": + + print '\nAUTODIAGNOSTIC\n==============\n' + + minimalVersion() + sys.exit(testSysteme()) + diff --git a/test/test1002/CTestTestfile.cmake b/test/test1002/CTestTestfile.cmake index 1a209cb..43a079a 100644 --- a/test/test1002/CTestTestfile.cmake +++ b/test/test1002/CTestTestfile.cmake @@ -1,4 +1,6 @@ -# Copyright (C) 2015 CEA/DEN, EDF R&D +# Copyright (C) 2008-2016 EDF R&D +# +# This file is part of SALOME ADAO module # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public