--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# %% LICENSE_SALOME_CEA_BEGIN
+# Copyright (C) 2008-2016 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org or email : webmaster.salome@opencascade.com
+# %% LICENSE_END
+
+
+"""
+test all SAT unittest files (test*.py) existing in subdirectories of a root directory
+
+example:
+ AllTestLauncherSat.py --rootPath='.' --pattern='test*.py'
+"""
+
+"""
+#### base of algorithm functionality
+
+#see http://www.voidspace.org.uk/python/articles/introduction-to-unittest.shtml
+
+import unittest
+
+import test_something
+import test_something2
+import test_something3
+
+loader = unittest.TestLoader()
+
+suite = loader.loadTestsFromModule(test_something)
+suite.addTests(loader.loadTestsFromModule(test_something2))
+suite.addTests(loader.loadTestsFromModule(test_something3))
+
+runner = unittest.TextTestRunner(verbosity=2)
+result = runner.run(suite)
+
+#### and so...
+"""
+
+
+import os
+import sys
+import unittest
+import argparse as AP
+
+import glob
+import fnmatch
+import pprint as PP #pretty print
+
+debug = False
+verboseImport = True
+
+def errPrint(aStr):
+ """to avoid write in html or xml file log message"""
+ sys.stderr.write(aStr + '\n')
+
+try:
+ import test.unittestpy.HTMLTestRunner as HTST
+except:
+ HTST = None
+ errPrint("""
+WARNING: no HTML output available.
+ try find 'test/unittestpy/HTMLTestRunner.py'.
+""")
+
+
+try:
+ import xmlrunner as XTST
+except:
+ XTST = None
+ errPrint("""
+WARNING: no XML output available.
+ try 'pip install unittest-xml-reporting'.
+""")
+
+
+###################################################################
+def locate(pattern, root=os.curdir):
+ """
+ Locate all files matching supplied filename pattern in and below
+ supplied root directory.
+ """
+ result = []
+ for path, dirs, files in os.walk(os.path.abspath(root)):
+ for filename in fnmatch.filter(files, pattern):
+ result.append( os.path.join(path, filename) )
+ return result
+
+def printEnv(search=""):
+ """
+ list all environment variables which name contains search string
+ example:
+ import AllTestLauncher as ATL
+ ATL.printEnv("ROOT_")
+ """
+ env=os.environ
+ for i in sorted(env):
+ if search in i:
+ print i
+
+def grepInEnv(search=""):
+ """
+ list all environment variables which contains search string
+ example:
+ import AllTestLauncher as ATL
+ ATL.grepInEnv("XDATA")
+ """
+ env=os.environ
+ for i in sorted(env):
+ done=False
+ for j in env[i].split(":"):
+ if search in j:
+ if not done:
+ print i+" contains "
+ done=True
+ print " "+j
+
+
+###################################################################
+def runOnArgs(args):
+ """
+ launch tests on args.pattern files
+ """
+ fromFileOrPath = args.rootPath
+ fileTestPattern = args.pattern
+ if fromFileOrPath == None:
+ directory, name = os.path.split( os.path.realpath( __file__ ) )
+ else:
+ if os.path.isdir(fromFileOrPath):
+ directory, name = (fromFileOrPath, None)
+ fileTestPatternCurrent = fileTestPattern
+ elif os.path.isfile(fromFileOrPath):
+ directory, name = os.path.split( os.path.realpath( fromFileOrPath ) )
+ fileTestPatternCurrent = name
+ else:
+ mess = "Cannot get file or directory '%s'" % fromFileOrPath
+ errPrint("ERROR: " + mess)
+ return None
+ #raise Exception("Cannot get file or directory '%s'" % fromFileOrPath)
+
+ #files = glob.glob(os.path.join(directory, "*Test.py"))
+ files = sorted(locate(fileTestPatternCurrent, directory))
+
+ filesForTest={}
+
+ for aFile in files:
+ aDir, aName = os.path.split(aFile)
+ aImport, ext = os.path.splitext(aName)
+
+ try:
+ if aFile in filesForTest.keys():
+ print "WARNING: imported yet: "+aFile
+ else:
+ sys.path.insert(0, aDir)
+ done = True
+ if verboseImport: errPrint("try import '%s'" % aImport)
+ aModule = __import__(aImport, globals(), locals(), [])
+ del sys.path[0]
+ done = False
+ filesForTest[aFile] = (aImport, aModule)
+ except:
+ if done:
+ del sys.path[0] #attention of sys.path appends
+ done = False
+ errPrint("ERROR: AllTestLauncher: import '%s'" % aFile)
+ continue
+
+ listfilesForTest = sorted(filesForTest.keys())
+ result = None
+
+ errPrint("AllTestLauncher test files:\n %s" % PP.pformat(listfilesForTest))
+
+ if len(listfilesForTest) == 0:
+ if debug: errPrint("WARNING: AllTestLauncher: empty list of test files")
+ return None
+
+ loader = unittest.TestLoader()
+ suite = None
+
+ for i,k in enumerate(listfilesForTest):
+ if debug: errPrint("Test: %s %s" % (i, k))
+ if i == 0:
+ suite = loader.loadTestsFromModule( filesForTest[k][1] )
+ pass
+ else:
+ suite.addTests( loader.loadTestsFromModule( filesForTest[k][1] ) )
+ pass
+
+ if args.type == "std":
+ runner = unittest.TextTestRunner(verbosity=args.verbosity)
+ elif args.type == "html":
+ runner = HTST.HTMLTestRunner(verbosity=args.verbosity, )
+ elif args.type == "xml":
+ if args.name == 'stdout':
+ #all-in-one xml output at 'sys.stdout' for pipe redirection
+ runner = XTST.XMLTestRunner(verbosity=args.verbosity, output=sys.stdout)
+ else:
+ #one file xml per test in suite in args.name directory
+ runner = XTST.XMLTestRunner(verbosity=args.verbosity, output=args.name)
+ else:
+ errPrint("ERROR: unknown type of output: '%s'" % args.type)
+ return None
+
+ if suite != None: result = runner.run(suite)
+ return result
+
+###################################################################
+def runFromEnvVar(envVar, fileTestPattern="*Test.py"):
+ """
+ example:
+ import AllTestLauncher as ATL
+ ATL.runFromEnvVar("MICROGEN_ROOT_DIR")
+ ATL.runFromEnvVar("MICROGEN_ROOT_DIR", "aggregate_*GJKTest.py")
+ """
+ env=os.environ
+ res = []
+ for i in sorted(env):
+ if envVar in i:
+ res.append(i)
+ if len(res) > 1:
+ mess = "multiple environment variable for '%s': %s" % (envVar, str(res))
+ errPrint("ERROR: " + mess)
+ return None
+ if len(res) < 1:
+ mess = "no environment variable for '%s'" % (envVar)
+ errPrint("ERROR: " + mess)
+ return None
+ res = res[0]
+ tmp = env[res].split(":")
+ if len(tmp) > 1:
+ mess = "need only one path in environment variable '%s'" % (res)
+ errPrint("ERROR: " + mess)
+ return None
+ run(fromFileOrPath=env[res], fileTestPattern=fileTestPattern)
+
+
+###################################################################
+def getParser():
+ parser = AP.ArgumentParser(description='launch All SAT python tests', argument_default=None)
+
+ parser.add_argument(
+ '-d', '--debug',
+ help='set debug mode, more verbose',
+ action='store_true',
+ )
+ parser.add_argument(
+ '-v', '--verbosity',
+ help='set verbosity of unittests [0|1|2...]',
+ default=2,
+ metavar='int'
+ )
+ parser.add_argument(
+ '-r', '--rootPath',
+ help='''\
+dir name with absolute or relative path stand for root directory
+of recursive searching unittest python files
+''',
+ default='.',
+ metavar='dirPath'
+ )
+ parser.add_argument(
+ '-p', '--pattern',
+ help="file pattern for unittest files ['test_*.py'|'*Test.py'...]",
+ default="test_*.py",
+ metavar='filePattern'
+ )
+ parser.add_argument(
+ '-t', '--type',
+ help="type of output: ['std'(standart ascii)|'xml'|'html']",
+ default="std",
+ choices=['std', 'xml', 'html'],
+ metavar='outputType'
+ )
+ parser.add_argument(
+ '-n', '--name',
+ help="""(only for type xml)
+name of directory output: ['test_reports'|...].
+If name = 'stdout' then all-in-one xml output at 'sys.stdout'. For pipe redirection:
+'>> AllTestLauncher.py -t xml -n stdout > tmp.xml'
+""",
+ default="test_reports",
+ metavar='dirName'
+ )
+ return parser
+
+#export PATH=/volatile/wambeke/SAT5/SAT5_S840_MATIX24/salomeTools-5-cvw:${PATH}
+
+###################################################################
+if __name__ == '__main__':
+ args = getParser().parse_args(sys.argv[1:])
+ debug = args.debug
+ directory = os.path.realpath(args.rootPath)
+ if debug: print("INFO: args:\n %s" % PP.pformat(args))
+ sys.path.insert(0, directory) #supposed to be root of a package
+ runOnArgs(args)
+ del sys.path[0]
+
+
+
import src
parser = src.options.Options()
-parser.add_option('n', 'name', 'string', 'name',
+parser.add_option(
+ 'n', 'name', 'string', 'name',
_('Optional: The name of the application (default is APPLICATION.virtual_app.name or '
- 'runAppli)'))
-parser.add_option('c', 'catalog', 'string', 'catalog',
- _('Optional: The resources catalog to use'))
-parser.add_option('t', 'target', 'string', 'target',
+ 'runAppli)') )
+parser.add_option(
+ 'c', 'catalog', 'string', 'catalog',
+ _('Optional: The resources catalog to use') )
+parser.add_option(
+ 't', 'target', 'string', 'target',
_('Optional: The directory where to create the application (default is '
- 'APPLICATION.workdir)'))
-parser.add_option('', 'gencat', 'string', 'gencat',
- _("Optional: Create a resources catalog for the specified machines "
- "(separated with ',')\n\tNOTICE: this command will ssh to retrieve "
- "information to each machine in the list"))
-parser.add_option('m', 'module', 'list2', 'modules',
+ 'APPLICATION.workdir)') )
+parser.add_option(
+ '', 'gencat', 'string', 'gencat',
+ _("""\
+Optional: Create a resources catalog for the specified machines (separated with ',')
+
+ NOTICE: this command will ssh to retrieve information to each machine in the list""") )
+parser.add_option(
+ 'm', 'module', 'list2', 'modules',
_("Optional: the restricted list of module(s) to include in the "
- "application"))
+ "application") )
##
# Creates an alias for runAppli.
:return: The text to display for the application command description.
:rtype: str
'''
- return _("The application command creates a SALOME application.\n"
- "WARNING: it works only for SALOME 6. Use the \"launcher\" "
- "command for newer versions of SALOME\n\nexample:\nsat application"
- " SALOME-6.6.0")
+ return _("""\
+The application command creates a SALOME application.
+
+WARNING:
+ It works only for SALOME 6.
+ Use the 'launcher' command for newer versions of SALOME
+
+example:
+>> sat application SALOME-6.6.0""")
##
# Runs the command.
# Define all possible option for the check command : sat check <options>
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
- _('Optional: products to configure. This option can be'
- ' passed several time to configure several products.'))
+ _('Optional: products to configure.\n'
+ 'This option can be passed several time to configure several products.'))
CHECK_PROPERTY = "has_unit_tests"
products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
- msg = _("Product %(1)s not defined in application %(2)s") %
+ msg = _("Product %(1)s not defined in application %(2)s") % \
{ '1': p, '2': cfg.VARS.application}
raise src.SatException(msg)
if ignored or not cmd_found:
log_step(logger, header, "ignored")
- logger.write("==== %(name)s %(IGNORED)s\n" %
+ logger.write("==== %(name)s %(IGNORED)s\n" % \
{ "name" : p_name ,
"IGNORED" : src.printcolors.printcInfo("IGNORED")},
4)
if res > 0:
logger.write("\r%s%s" % (header, " " * len_end_line), 3)
logger.write("\r" + header + src.printcolors.printcError("KO"))
- logger.write("==== %(KO)s in check of %(name)s \n" %
+ logger.write("==== %(KO)s in check of %(name)s \n" % \
{ "name" : p_name , "KO" : src.printcolors.printcInfo("ERROR")}, 4)
logger.flush()
else:
logger.write("\r%s%s" % (header, " " * len_end_line), 3)
logger.write("\r" + header + src.printcolors.printcSuccess("OK"))
logger.write("==== %s \n" % src.printcolors.printcInfo("OK"), 4)
- logger.write("==== Check of %(name)s %(OK)s \n" %
+ logger.write("==== Check of %(name)s %(OK)s \n" % \
{ "name" : p_name , "OK" : src.printcolors.printcInfo("OK")}, 4)
logger.flush()
logger.write("\n", 3, False)
:return: The text to display for the check command description.
:rtype: str
'''
- return _("The check command executes the \"check\" command in"
- " the build directory of all the products of the application."
- "\nIt is possible to reduce the list of products to check by using"
- " the --products option\n\nexample\nsat check SALOME-master "
- "--products KERNEL,GUI,GEOM")
+ return _("""\
+The check command executes the 'check' command in the build directory of
+all the products of the application.
+It is possible to reduce the list of products to check
+by using the --products option
+
+example:
+>> sat check SALOME-master --products KERNEL,GUI,GEOM""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with check parameter.
# Print some informations
logger.write(_('Executing the check command in the build '
- 'directories of the application %s\n') %
+ 'directories of the application %s\n') % \
src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
info = [(_("BUILD directory"),
else:
final_status = "KO"
- logger.write(_("\nCheck: %(status)s (%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nCheck: %(status)s (%(1)d/%(2)d)\n") % \
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_products - res,
- 'nb_products': nb_products }, 1)
+ '1': nb_products - res,
+ '2': nb_products }, 1)
return res
_('Optional: Products to clean. This option can be'
' passed several time to clean several products.'))
parser.add_option('', 'properties', 'string', 'properties',
- _('Optional: Filter the products by their properties.\n\tSyntax: '
- '--properties <property>:<value>'))
+ _('Optional: Filter the products by their properties.\n'
+ '\tSyntax: --properties <property>:<value>'))
parser.add_option('s', 'sources', 'boolean', 'sources',
_("Optional: Clean the product source directories."))
parser.add_option('b', 'build', 'boolean', 'build',
products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
- raise src.SatException(_("Product %(product)s "
- "not defined in application %(application)s") %
- { 'product': p, 'application': cfg.VARS.application} )
+ raise src.SatException(
+ _("Product %(product)s not defined in application %(application)s") % \
+ {'product': p, 'application': cfg.VARS.application} )
# Construct the list of tuple containing
# the products name and their definition
for path in l_paths:
if not path.isdir():
msg = _("WARNING: the path %s does not "
- "exists (or is not a directory)\n" % path.__str__())
+ "exists (or is not a directory)\n") % path.__str__()
logger.write(src.printcolors.printcWarning(msg), 1)
else:
logger.write(_("Removing %s ...") % path.__str__())
:return: The text to display for the clean command description.
:rtype: str
'''
- return _("The clean command suppress the source, build, or install "
- "directories of the application products.\nUse the options to"
- " define what directories you want to suppress and to reduce "
- "the list of products\n\nexample:\nsat clean SALOME-master "
- "--build --install --properties is_salome_module:yes")
+ return _("""\
+The clean command suppress the source, build, or install directories
+of the application products.
+Use the options to define what directories you want to suppress and
+to reduce the list of products
+
+example:
+>> sat clean SALOME-master --build --install --properties is_salome_module:yes""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with clean parameter.
sat_command = (runner.cfg.VARS.salometoolsway +
runner.cfg.VARS.sep +
"sat -h clean")
- logger.write(_("Please specify what you want to suppress: "
- "tap \"%s\"\n" % sat_command))
+ logger.write(_("Please specify what you want to suppress: tap '%s'\n") % sat_command)
return
# Check with the user if he really wants to suppress the directories
# Define all possible option for the compile command : sat compile <options>
parser = src.options.Options()
-parser.add_option('p', 'products', 'list2', 'products',
- _('Optional: products to configure. This option can be'
- ' passed several time to configure several products.'))
-parser.add_option('', 'with_fathers', 'boolean', 'fathers',
- _("Optional: build all necessary products to the given product (KERNEL is "
- "build before building GUI)."), False)
-parser.add_option('', 'with_children', 'boolean', 'children',
- _("Optional: build all products using the given product (all SMESH plugins"
- " are build after SMESH)."), False)
-parser.add_option('', 'clean_all', 'boolean', 'clean_all',
+parser.add_option(
+ 'p', 'products', 'list2', 'products',
+ _('Optional: products to configure. This option can be passed several time to configure several products.'))
+parser.add_option(
+ '', 'with_fathers', 'boolean', 'fathers',
+ _("Optional: build all necessary products to the given product (KERNEL is build before building GUI)."),
+ False)
+parser.add_option(
+ '', 'with_children', 'boolean', 'children',
+ _("Optional: build all products using the given product (all SMESH plugins are build after SMESH)."),
+ False)
+parser.add_option(
+ '', 'clean_all', 'boolean', 'clean_all',
_("Optional: clean BUILD dir and INSTALL dir before building product."),
False)
-parser.add_option('', 'clean_install', 'boolean', 'clean_install',
+parser.add_option(
+ '', 'clean_install', 'boolean', 'clean_install',
_("Optional: clean INSTALL dir before building product."), False)
-parser.add_option('', 'make_flags', 'string', 'makeflags',
+parser.add_option(
+ '', 'make_flags', 'string', 'makeflags',
_("Optional: add extra options to the 'make' command."))
-parser.add_option('', 'show', 'boolean', 'no_compile',
+parser.add_option(
+ '', 'show', 'boolean', 'no_compile',
_("Optional: DO NOT COMPILE just show if products are installed or not."),
False)
-parser.add_option('', 'stop_first_fail', 'boolean', 'stop_first_fail', _(
- "Optional: Stops the command at first product compilation"
- " fail."), False)
-parser.add_option('', 'check', 'boolean', 'check', _(
- "Optional: execute the unit tests after compilation"), False)
-
-parser.add_option('', 'clean_build_after', 'boolean', 'clean_build_after',
- _('Optional: remove the build directory after successful compilation'), False)
+parser.add_option(
+ '', 'stop_first_fail', 'boolean', 'stop_first_fail', _(
+ "Optional: Stops the command at first product compilation fail."),
+ False)
+parser.add_option(
+ '', 'check', 'boolean', 'check',
+ _("Optional: execute the unit tests after compilation"),
+ False)
+parser.add_option(
+ '', 'clean_build_after', 'boolean', 'clean_build_after',
+ _('Optional: remove the build directory after successful compilation'),
+ False)
def get_products_list(options, cfg, logger):
'''method that gives the product list with their informations from
products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
- raise src.SatException(_("Product %(product)s "
- "not defined in application %(application)s") %
- { 'product': p, 'application': cfg.VARS.application} )
+ raise src.SatException(
+ _("Product %(product)s not defined in application %(application)s") %
+ { 'product': p, 'application': cfg.VARS.application} )
# Construct the list of tuple containing
# the products name and their definition
l_children_name = [pn_pi[0] for pn_pi in l_children]
if child_name not in l_children_name:
if child_name not in config.APPLICATION.products:
- msg = _("The product %(child_name)s that is in %(product_nam"
- "e)s children is not present in application "
- "%(appli_name)s" % {"child_name" : child_name,
- "product_name" : p_name.name,
- "appli_name" : config.VARS.application})
+ msg = _("""\
+The product %(child_name)s that is in %(product_name)s children
+is not present in application %(appli_name)s.""" %
+ {"child_name" : child_name,
+ "product_name" : p_name.name,
+ "appli_name" : config.VARS.application} )
raise src.SatException(msg)
prod_info_child = src.product.get_product_config(config,
child_name)
if error_step != "CHECK":
# Clean the install directory if there is any
- logger.write(_(
- "Cleaning the install directory if there is any\n"),
- 5)
+ logger.write(
+ _("Cleaning the install directory if there is any\n"), 5)
sat.clean(config.VARS.application +
" --products " + p_name +
" --install",
logger.write("\n==== %(KO)s in compile of %(name)s \n" %
{ "name" : p_name , "KO" : src.printcolors.printcInfo("ERROR")}, 4)
if error_step == "CHECK":
- logger.write(_("\nINSTALL directory = %s" %
- src.printcolors.printcInfo(p_info.install_dir)), 3)
+ logger.write(_("\nINSTALL directory = %s") %
+ src.printcolors.printcInfo(p_info.install_dir), 3)
logger.flush()
else:
logger.write("\r%s%s" % (header, " " * len_end_line), 3)
logger.write("\r" + header + src.printcolors.printcSuccess("OK"))
- logger.write(_("\nINSTALL directory = %s" %
- src.printcolors.printcInfo(p_info.install_dir)), 3)
+ logger.write(_("\nINSTALL directory = %s") %
+ src.printcolors.printcInfo(p_info.install_dir), 3)
logger.write("\n==== %s \n" % src.printcolors.printcInfo("OK"), 4)
logger.write("\n==== Compilation of %(name)s %(OK)s \n" %
{ "name" : p_name , "OK" : src.printcolors.printcInfo("OK")}, 4)
:return: The text to display for the compile command description.
:rtype: str
'''
- return _("The compile command constructs the products of the application"
- "\n\nexample:\nsat compile SALOME-master --products KERNEL,GUI,"
- "MEDCOUPLING --clean_all")
+ return _("""\
+The compile command constructs the products of the application
+
+example:
+>> sat compile SALOME-master --products KERNEL,GUI,MEDCOUPLING --clean_all""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with compile parameter.
options.products is None and
not runner.options.batch):
rep = input(_("You used --clean_all without specifying a product"
- " are you sure you want to continue? [Yes/No] "))
+ " are you sure you want to continue? [Yes/No] "))
if rep.upper() != _("YES").upper():
return 0
# Print some informations
logger.write(_('Executing the compile commands in the build '
- 'directories of the products of '
- 'the application %s\n') %
- src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
+ 'directories of the products of the application %s\n') %
+ src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
info = [
(_("SOURCE directory"),
else:
final_status = "KO"
- logger.write(_("\nCompilation: %(status)s (%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nCompilation: %(status)s (%(1)d/%(2)d)\n") %
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_products - res,
- 'nb_products': nb_products }, 1)
+ '1': nb_products - res,
+ '2': nb_products }, 1)
code = res
if code != 0:
parser.add_option('', 'show_patchs', 'boolean', 'show_patchs',
_("Optional: synthetic view of all patches used in the application"))
parser.add_option('c', 'copy', 'boolean', 'copy',
- _("""Optional: copy a config file to the personal config files directory.
-\tWARNING the included files are not copied.
+ _("""Optional: copy a config file (.pyconf) to the personal config files directory.
+\tWarning: the included files are not copied.
\tIf a name is given the new config file takes the given name."""))
parser.add_option('n', 'no_label', 'boolean', 'no_label',
_("Internal use: do not print labels, Works only with --value and --list."))
for project_pyconf_path in cfg.PROJECTS.project_file_paths:
if not os.path.exists(project_pyconf_path):
msg = _("WARNING: The project file %s cannot be found. "
- "It will be ignored\n" % project_pyconf_path)
+ "It will be ignored\n") % project_pyconf_path
sys.stdout.write(msg)
continue
- project_name = os.path.basename(
- project_pyconf_path)[:-len(".pyconf")]
+ project_name = os.path.basename(project_pyconf_path)[:-len(".pyconf")]
try:
project_pyconf_dir = os.path.dirname(project_pyconf_path)
project_cfg = src.pyconf.Config(open(project_pyconf_path),
PWD=("", project_pyconf_dir))
except Exception as e:
- msg = _("ERROR: Error in configuration file: "
- "%(file_path)s\n %(error)s\n") % \
- {'file_path' : project_pyconf_path, 'error': str(e) }
+ msg = _("ERROR: Error in configuration file: %(file_path)s\n %(error)s\n") % \
+ {'file_path' : project_pyconf_path, 'error': str(e) }
sys.stdout.write(msg)
continue
projects_cfg.PROJECTS.projects.addMapping(project_name,
application_cfg = src.pyconf.Config(application + '.pyconf')
except IOError as e:
raise src.SatException(_("%s, use 'config --list' to get the"
- " list of available applications.") %e)
+ " list of available applications.") % e)
except src.pyconf.ConfigError as e:
if (not ('-e' in parser.parse_args()[1])
or ('--edit' in parser.parse_args()[1])
and command == 'config'):
- raise src.SatException(_("Error in configuration file: "
- "%(application)s.pyconf\n "
- " %(error)s") % \
+ raise src.SatException(
+ _("Error in configuration file: (1)s.pyconf\n %(2)s") % \
{ 'application': application, 'error': str(e) } )
else:
sys.stdout.write(src.printcolors.printcWarning(
- "There is an error in the file"
- " %s.pyconf.\n" % cfg.VARS.application))
+ "There is an error in the file %s.pyconf.\n" % \
+ cfg.VARS.application))
do_merge = False
except Exception as e:
- if (not ('-e' in parser.parse_args()[1])
- or ('--edit' in parser.parse_args()[1])
- and command == 'config'):
+ if ( not('-e' in parser.parse_args()[1]) or
+ ('--edit' in parser.parse_args()[1]) and
+ command == 'config' ):
sys.stdout.write(src.printcolors.printcWarning("%s\n" % str(e)))
- raise src.SatException(_("Error in configuration file:"
- " %(application)s.pyconf\n") % \
- { 'application': application} )
+ raise src.SatException(
+ _("Error in configuration file: %s.pyconf\n") % application )
else:
sys.stdout.write(src.printcolors.printcWarning(
- "There is an error in the file"
- " %s.pyconf. Opening the file with the"
- " default viewer\n" % cfg.VARS.application))
- sys.stdout.write("The error:"
- " %s\n" % src.printcolors.printcWarning(
- str(e)))
+ "ERROR: in file %s.pyconf. Opening the file with the default viewer\n" % \
+ cfg.VARS.application))
+ sys.stdout.write("\n%s\n" % src.printcolors.printcWarning(str(e)))
do_merge = False
else:
products_cfg.PRODUCTS[product_name] = prod_cfg
except Exception as e:
msg = _(
- "WARNING: Error in configuration file"
- ": %(prod)s\n %(error)s" % \
+ "WARNING: Error in configuration file: %(prod)s\n %(error)s" % \
{'prod' : product_name, 'error': str(e) })
sys.stdout.write(msg)
:rtype: str
'''
if not self.user_config_file_path:
- raise src.SatException(_("Error in get_user_config_file: "
- "missing user config file path"))
+ raise src.SatException(
+ _("Error in get_user_config_file: missing user config file path") )
return self.user_config_file_path
def check_path(path, ext=[]):
'''
# check if file exists
if not os.path.exists(path):
- return "'%s'" % path + " " + src.printcolors.printcError(_(
- "** not found"))
+ return "'%s' %s" % (path, src.printcolors.printcError(_("** not found")))
# check extension
if len(ext) > 0:
fe = os.path.splitext(path)[1].lower()
if fe not in ext:
- return "'%s'" % path + " " + src.printcolors.printcError(_(
- "** bad extension"))
+ return "'%s' %s" % (path, src.printcolors.printcError(_("** bad extension")))
return path
check_path(pinfo.install_dir),
2)
else:
- logger.write(" " +
- src.printcolors.printcWarning(_("no install dir")) +
- "\n", 2)
+ logger.write(" %s\n" % src.printcolors.printcWarning(_("no install dir")) , 2)
else:
logger.write("\n", 2)
msg = _("This product does not compile")
:return: The text to display for the config command description.
:rtype: str
'''
- return _("The config command allows manipulation "
- "and operation on config files.\n\nexample:\nsat config "
- "SALOME-master --info ParaView")
+ return _("""\
+The config command allows manipulation and operation on config files.
+
+example:
+>> sat config SALOME-master --info ParaView""")
def run(args, runner, logger):
elif options.edit:
editor = runner.cfg.USER.editor
if ('APPLICATION' not in runner.cfg and
- 'open_application' not in runner.cfg): # edit user pyconf
- usercfg = os.path.join(runner.cfg.VARS.personalDir,
- 'SAT.pyconf')
- logger.write(_("Openning %s\n" % usercfg), 3)
+ 'open_application' not in runner.cfg): # edit user pyconf
+ usercfg = os.path.join(runner.cfg.VARS.personalDir, 'SAT.pyconf')
+ logger.write(_("Opening %s\n") % usercfg, 3)
src.system.show_in_editor(editor, usercfg, logger)
else:
# search for file <application>.pyconf and open it
for path in runner.cfg.PATHS.APPLICATIONPATH:
- pyconf_path = os.path.join(path,
- runner.cfg.VARS.application + ".pyconf")
+ pyconf_path = os.path.join(path, runner.cfg.VARS.application + ".pyconf")
if os.path.exists(pyconf_path):
- logger.write(_("Openning %s\n" % pyconf_path), 3)
+ logger.write(_("Opening %s\n") % pyconf_path, 3)
src.system.show_in_editor(editor, pyconf_path, logger)
break
if options.info in runner.cfg.APPLICATION.products:
show_product_info(runner.cfg, options.info, logger)
return
- raise src.SatException(_("%(product_name)s is not a product "
- "of %(application_name)s.") %
- {'product_name' : options.info,
- 'application_name' :
- runner.cfg.VARS.application})
+ raise src.SatException(
+ _("%(product_name)s is not a product of %(application_name)s.") % \
+ {'product_name' : options.info, 'application_name' : runner.cfg.VARS.application} )
# case : copy an existing <application>.pyconf
# to ~/.salomeTools/Applications/LOCAL_<application>.pyconf
break
if len(source_full_path) == 0:
- raise src.SatException(_(
- "Config file for product %s not found\n") % source)
+ raise src.SatException(
+ _("Config file for product %s not found\n") % source )
else:
if len(args) > 0:
# a name is given as parameter, use it
dest = runner.cfg.VARS.application
# the full path
- dest_file = os.path.join(runner.cfg.VARS.personalDir,
- 'Applications', dest + '.pyconf')
+ dest_file = os.path.join(
+ runner.cfg.VARS.personalDir, 'Applications', dest + '.pyconf' )
if os.path.exists(dest_file):
- raise src.SatException(_("A personal application"
- " '%s' already exists") % dest)
+ raise src.SatException(
+ _("A personal application '%s' already exists") % dest )
# perform the copy
shutil.copyfile(source_full_path, dest_file)
logger.write("------ %s\n" % src.printcolors.printcHeader(path))
if not os.path.exists(path):
- logger.write(src.printcolors.printcError(_(
- "Directory not found")) + "\n")
+ logger.write(src.printcolors.printcError(
+ _("Directory not found")) + "\n" )
else:
for f in sorted(os.listdir(path)):
# ignore file that does not ends with .pyconf
elif options.show_patchs:
src.check_config_has_application(runner.cfg)
# Print some informations
- logger.write(_('Show the patchs of application %s\n') %
- src.printcolors.printcLabel(runner.cfg.VARS.application), 3)
+ logger.write(_('Show the patchs of application %s\n') % \
+ src.printcolors.printcLabel(runner.cfg.VARS.application), 3)
logger.write("\n", 2, False)
show_patchs(runner.cfg, logger)
products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
- raise src.SatException(_("Product %(product)s "
- "not defined in application %(application)s") %
- { 'product': p, 'application': cfg.VARS.application} )
+ raise src.SatException(
+ _("Product %(product)s not defined in application %(application)s") %
+ {'product': p, 'application': cfg.VARS.application} )
# Construct the list of tuple containing
# the products name and their definition
:return: The text to display for the configure command description.
:rtype: str
'''
- return _("The configure command executes in the build directory"
- " the configure commands corresponding\nto the compilation mode"
- " of the application products.\nThe possible compilation modes"
- " are \"cmake\", \"autotools\", or a script.\n\nHere are the "
- "commands to be run :\nautotools: build_configure and configure\n"
- "cmake: cmake\nscript: do nothing\n\nexample:\nsat configure "
- "SALOME-master --products KERNEL,GUI,PARAVIS")
+ return _("""\
+The configure command executes in the build directory commands
+corresponding to the compilation mode of the application products.
+The possible compilation modes are 'cmake', 'autotools', or 'script'.
+
+Here are the commands to be run:
+ autotools: >> build_configure and configure
+ cmake: >> cmake
+ script: (do nothing)
+
+example:
+>> sat configure SALOME-master --products KERNEL,GUI,PARAVIS""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with make parameter.
'valid_result': nb_products - res,
'nb_products': nb_products }, 1)
- return res
\ No newline at end of file
+ return res
##
# Describes the command
def description():
- return _("The environ command generates the environment files of your "
- "application.\n\nexample:\nsat environ SALOME-master")
+ return _("""\
+The environ command generates the environment files of your application.
+
+example:
+>> sat environ SALOME-master""")
##
# Runs the command.
# create a parser for command line options
parser = src.options.Options()
-parser.add_option("s",
- "sources",
- "boolean",
- "sources",
- _("Search the duplicate files in the SOURCES directory."))
-parser.add_option("p",
- "path",
- "list2",
- "path",
- _("Optional: Search the duplicate files in the given "
- "directory paths."))
-parser.add_option("",
- "exclude-file",
- "list2",
- "exclude_file",
- _("Optional: Override the default list of filtered files."))
-parser.add_option("",
- "exclude-extension",
- "list2",
- "exclude_extension",
- _("Optional: Override the default list of filtered "
- "extensions."))
-parser.add_option("",
- "exclude-path",
- "list2",
- "exclude_path",
- _("Optional: Override the default list of filtered paths."))
+parser.add_option(
+ "s",
+ "sources",
+ "boolean",
+ "sources",
+ _("Search the duplicate files in the SOURCES directory.") )
+parser.add_option(
+ "p",
+ "path",
+ "list2",
+ "path",
+ _("Optional: Search the duplicate files in the given directory paths.") )
+parser.add_option(
+ "",
+ "exclude-file",
+ "list2",
+ "exclude_file",
+ _("Optional: Override the default list of filtered files.") )
+parser.add_option(
+ "",
+ "exclude-extension",
+ "list2",
+ "exclude_extension",
+ _("Optional: Override the default list of filtered extensions.") )
+parser.add_option(
+ "",
+ "exclude-path",
+ "list2",
+ "exclude_path",
+ _("Optional: Override the default list of filtered paths.") )
+
+default_extension_ignored = \
+ 'html png txt js xml cmake gif m4 in pyo pyc doctree css'.split()
+
+default_files_ignored = \
+ '__init__.py Makefile.am VERSION build_configure README AUTHORS NEWS COPYING ChangeLog'.split()
-default_extension_ignored = ['html', 'png', 'txt', 'js', 'xml', 'cmake', 'gif',
- 'm4', 'in', 'pyo', 'pyc', 'doctree', 'css']
-default_files_ignored = ['__init__.py', 'Makefile.am', 'VERSION',
- 'build_configure',
- 'README', 'AUTHORS', 'NEWS', 'COPYING', 'ChangeLog']
default_directories_ignored = []
def list_directory(lpath, extension_ignored, files_ignored, directories_ignored):
:return: The text to display for the find_duplicates command description.
:rtype: str
'''
- return _("The find_duplicates command search recursively for all duplicates"
- " files in a the INSTALL directory (or the optionally given "
- "directory) and prints the found files to the terminal.\n\n"
- "example:\nsat find_duplicates --path /tmp")
+ return _("""\
+The find_duplicates command search recursively for all duplicates files
+in INSTALL directory (or the optionally given directory) and
+prints the found files to the terminal.
+
+example:
+>> sat find_duplicates --path /tmp""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with find_duplicates
l_dir_path = []
for dir_path in l_path:
if not(os.path.isdir(dir_path)):
- msg = _("%s does not exists or is not a directory path: "
- "it will be ignored" % dir_path)
+ msg = _("%s does not exists or is not a directory path: it will be ignored" %
+ dir_path)
logger.write("%s\n" % src.printcolors.printcWarning(msg), 3)
continue
l_dir_path.append(dir_path)
for elem in dic_fic_paths:
if len(dic_fic_paths[elem])<2:
logger.write(
- _("WARNING : element %s has not more than two paths.\n") % elem,
- 3 )
+ _("WARNING : element %s has not more than two paths.\n") % elem,
+ 3 )
# Display the results
:return: The text to display for the generate command description.
:rtype: str
'''
- return _("The generate command generates SALOME modules from 'pure cpp' "
- "products.\nWARNING this command NEEDS YACSGEN to run!\n\nexample:"
- "\nsat generate SALOME-master --products FLICACPP")
+ return _("""\
+The generate command generates SALOME modules from 'pure cpp' products.
+WARNING: this command NEEDS YACSGEN to run.
+
+example:
+>> sat generate SALOME-master --products FLICACPP""")
def run(args, runner, logger):
if isinstance(yacsgen_dir, tuple):
# The check failed
__, error = yacsgen_dir
- msg = _("Error: %s" % error)
+ msg = _("Error: %s") % error
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
return 1
config.LOCAL[key] = value
except Exception as e:
err = str(e)
- msg = _("Unable to update the local.pyconf file: %s\n" % err)
+ msg = _("Unable to update the local.pyconf file: %s\n") % err
logger.write(msg, 1)
return 1
# If it is a file, do nothing and return error
if path.isfile():
- msg = _("Error: The given path is a file. Please provide a path to a directory")
+ msg = _("ERROR: The given path is a file. Please provide a path to a directory")
logger.write(src.printcolors.printcError(msg), 1)
return 1
src.ensure_path_exists(str(path))
except Exception as e:
err = src.printcolors.printcError(str(e))
- msg = _("Unable to create the directory '%(1)s': %(2)s\n" %
- {"1": str(path), "2": err})
+ msg = _("Unable to create the directory '%(1)s': %(2)s\n") % \
+ {"1": str(path), "2": err}
logger.write(msg, 1)
return 1
(options, args) = parser.parse_args(args)
# Print some informations
- logger.write(_('Local Settings of SAT %s\n\n') %
+ logger.write(_('Local Settings of SAT %s\n\n') % \
src.printcolors.printcLabel(runner.cfg.VARS.salometoolsway), 1)
res = 0
# Define all possible option for the make command : sat make <options>
parser = src.options.Options()
-parser.add_option('j', 'jobs_config', 'string', 'jobs_cfg',
- _('Mandatory: The name of the config file that contains'
- ' the jobs configuration'))
-parser.add_option('', 'name', 'string', 'job',
- _('Mandatory: The job name from which to execute commands.'), "")
+parser.add_option(
+ 'j', 'jobs_config', 'string', 'jobs_cfg',
+ _('Mandatory: The name of the config file that contains the jobs configuration') )
+parser.add_option(
+ '', 'name', 'string', 'job',
+ _('Mandatory: The job name from which to execute commands.'), "" )
def description():
'''method that is called when salomeTools is called with --help option.
break
if not found:
- msg = _("The file configuration %(name_file)s was not found."
- "\nUse the --list option to get the possible files.")
+ msg = _("The file configuration %(name_file)s was not found.\n"
+ "Use the --list option to get the possible files.")
src.printcolors.printcError(msg)
return 1
found = True
break
if not found:
- msg = _("Impossible to find the job \"%(job_name)s\" in "
- "%(jobs_config_file)s" % {"job_name" : options.job,
- "jobs_config_file" : file_jobs_cfg})
+ msg = _("Impossible to find the job '%(job_name)s' in %(jobs_config_file)s" % \
+ {"job_name" : options.job, "jobs_config_file" : file_jobs_cfg})
logger.write(src.printcolors.printcError(msg) + "\n")
return 1
else:
if sat_command_name != "test":
res = 1
- logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS),
- error), 3)
+ logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS), error), 3)
+
if len(stack) > 0:
logger.write('stack: %s\n' % stack, 3)
else:
final_status = "KO"
- logger.write(_("\nCommands: %(status)s (%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nCommands: %(status)s (%(1)d/%(2)d)\n") % \
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_pass,
- 'nb_products': len(commands) }, 3)
+ '1': nb_pass,
+ '2': len(commands) }, 3)
- return res
\ No newline at end of file
+ return res
parser = src.options.Options()
-parser.add_option('n', 'name', 'list2', 'jobs_cfg',
- _('Mandatory: The name of the config file that contains'
- ' the jobs configuration. Can be a list.'))
-parser.add_option('o', 'only_jobs', 'list2', 'only_jobs',
- _('Optional: the list of jobs to launch, by their name. '))
-parser.add_option('l', 'list', 'boolean', 'list',
- _('Optional: list all available config files.'))
-parser.add_option('t', 'test_connection', 'boolean', 'test_connection',
- _("Optional: try to connect to the machines. "
- "Not executing the jobs."),
- False)
-parser.add_option('p', 'publish', 'boolean', 'publish',
- _("Optional: generate an xml file that can be read in a "
- "browser to display the jobs status."),
- False)
-parser.add_option('i', 'input_boards', 'string', 'input_boards', _("Optional: "
- "the path to csv file that contain "
- "the expected boards."),"")
-parser.add_option('', 'completion', 'boolean', 'no_label',
- _("Optional (internal use): do not print labels, Works only "
- "with --list."),
- False)
+parser.add_option(
+ 'n', 'name', 'list2', 'jobs_cfg',
+ _('Mandatory: The name of the config file that contains the jobs configuration. Can be a list.') )
+parser.add_option(
+ 'o', 'only_jobs', 'list2', 'only_jobs',
+ _('Optional: the list of jobs to launch, by their name. ') )
+parser.add_option(
+ 'l', 'list', 'boolean', 'list',
+ _('Optional: list all available config files.') )
+parser.add_option(
+ 't', 'test_connection', 'boolean', 'test_connection',
+ _("Optional: try to connect to the machines. Not executing the jobs."),
+ False )
+parser.add_option(
+ 'p', 'publish', 'boolean', 'publish',
+ _("Optional: generate an xml file that can be read in a browser to display the jobs status."),
+ False )
+parser.add_option(
+ 'i', 'input_boards', 'string', 'input_boards', _("Optional: "
+ "the path to csv file that contain the expected boards."),
+ "" )
+parser.add_option(
+ '', 'completion', 'boolean', 'no_label',
+ _("Optional (internal use): do not print labels, Works only with --list."),
+ False )
class Machine(object):
'''Class to manage a ssh connection on a machine
return res
def put_dir(self, source, target, filters = []):
- ''' Uploads the contents of the source directory to the target path. The
- target directory needs to exists. All sub-directories in source are
- created under target.
+ '''Uploads the contents of the source directory to the target path.
+ The target directory needs to exists.
+ All sub-directories in source are created under target.
'''
for item in os.listdir(source):
if item in filters:
self.put_dir(source_path, destination_path)
def mkdir(self, path, mode=511, ignore_existing=False):
- ''' Augments mkdir by adding an option to not fail
- if the folder exists
+ '''As mkdir by adding an option to not fail if the folder exists
'''
try:
self.sftp.mkdir(path, mode)
try:
self.get_log_files()
except Exception as e:
- self.err += _("Unable to get remote log files: %s" % e)
+ self.err += _("Unable to get remote log files: %s") % e
return self._has_finished
# The first line is the result of the command (0 success or 1 fail)
self.res_job = file_lines[0]
except Exception as e:
- self.err += _("Unable to get status from remote file '%(1)s': %(2)s" %
- {"1": remote_path, "2": str(e)})
+ self.err += _("Unable to get status from remote file '%(1)s': %(2)s") % \
+ {"1": remote_path, "2": str(e)}
for i, job_path_remote in enumerate(file_lines[1:]):
try:
self.machine.sftp.get(job_path_remote, local_path)
self.remote_log_files.append(local_path)
except Exception as e:
- self.err += _("Unable to get %(1)s log file from remote: %(2)s" %
- {"1": str(job_path_remote), "2": str(e)})
+ self.err += _("Unable to get %(1)s log file from remote: %(2)s") % \
+ {"1": str(job_path_remote), "2": str(e)}
def has_failed(self):
'''Returns True if the job has failed.
self._has_begun = True
self._has_finished = True
self.cancelled = True
- self.out += _("This job was not launched because its father has failed.")
- self.err += _("This job was not launched because its father has failed.")
+ msg = _("This job was not launched because its father has failed.")
+ self.out += msg
+ self.err += msg
def is_running(self):
'''Returns True if the job commands are running
if self.has_begun():
msg = _("WARNING: A job can only be launched one time")
msg2 = _("Trying to launch the job \"%s\" whereas it has "
- "already been launched." % self.name)
- self.logger.write(src.printcolors.printcWarning("%s\n%s\n" % (msg,
- msg2)))
+ "already been launched.") % self.name
+ self.logger.write(
+ src.printcolors.printcWarning("%s\n%s\n" % (msg,msg2)) )
return
# Do not execute the command if the machine could not be reached
'''
# Print header
- self.logger.write(src.printcolors.printcInfo(
- _('Executing the jobs :\n')))
+ self.logger.write(
+ src.printcolors.printcInfo(_('Executing the jobs :\n')) )
text_line = ""
for host_port in self.lhosts:
host = host_port[0]
##
# Describes the command
def description():
- return _("The jobs command launches maintenances that are described"
- " in the dedicated jobs configuration file.\n\nexample:\nsat "
- "jobs --name my_jobs --publish")
+ return _("""\
+The jobs command launches maintenances that are described in
+the dedicated jobs configuration file.
+
+example:
+>> sat jobs --name my_jobs --publish""")
##
# Runs the command.
for config_file in options.jobs_cfg:
found, file_jobs_cfg = get_config_file_path(config_file, l_cfg_dir)
if not found:
- msg = _("The file configuration %s was not found."
- "\nUse the --list option to get the "
- "possible files." % config_file)
+ msg = _("""\
+The file configuration %s was not found.
+Use the --list option to get the possible files.""") % config_file
logger.write("%s\n" % src.printcolors.printcError(msg), 1)
return 1
l_conf_files_path.append(file_jobs_cfg)
parser = src.options.Options()
-parser.add_option('n', 'name', 'string', 'name', _('Optional: The name of the'
- ' launcher (default is '
- 'APPLICATION.profile.launcher_name)'))
-parser.add_option('c', 'catalog', 'string', 'catalog',
- _('Optional: The resources catalog to use'))
-parser.add_option('', 'gencat', 'string', 'gencat',
- _("Optional: Create a resources catalog for the specified machines "
- "(separated with ',') \n\tNOTICE: this command will ssh to retrieve"
- " information to each machine in the list"))
+parser.add_option(
+ 'n', 'name', 'string', 'name',
+ _('Optional: The name of the launcher (default is APPLICATION.profile.launcher_name)') )
+parser.add_option(
+ 'c', 'catalog', 'string', 'catalog',
+ _('Optional: The resources catalog to use') )
+parser.add_option(
+ '', 'gencat', 'string', 'gencat',
+ _("Optional: Create a resources catalog for the specified machines (separated with ',')\n"
+ " NOTICE: this command will ssh to retrieve information to each machine in the list") )
def generate_launch_file(config,
logger,
##
# Describes the command
def description():
- return _("The launcher command generates a SALOME launcher.\n\nexample:"
- "\nsat launcher SALOME-master")
+ return _("""\
+The launcher command generates a SALOME launcher.
+
+example:
+>> sat launcher SALOME-master""")
##
# Runs the command.
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
_('Optional: products to configure. This option can be'
- ' passed several time to configure several products.'))
+ ' passed several time to configure several products.'))
parser.add_option('o', 'option', 'string', 'option',
_('Optional: Option to add to the make command.'), "")
:return: The text to display for the make command description.
:rtype: str
'''
- return _("The make command executes the \"make\" command in"
- " the build directory.\nexample:\nsat make SALOME-master "
- "--products Python,KERNEL,GUI")
+ return _("""\
+The make command executes the 'make' command in the build directory.
+
+example:
+>> sat make SALOME-master --products Python,KERNEL,GUI""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with make parameter.
products_infos = get_products_list(options, runner.cfg, logger)
# Print some informations
- logger.write(_('Executing the make command in the build '
- 'directories of the application %s\n') %
- src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
+ logger.write(
+ _('Executing the make command in the build directories of the application %s\n') %
+ src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
info = [(_("BUILD directory"),
os.path.join(runner.cfg.APPLICATION.workdir, 'BUILD'))]
else:
final_status = "KO"
- logger.write(_("\nMake: %(status)s (%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nMake: %(status)s (%(1)d/%(2)d)\n") %
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_products - res,
- 'nb_products': nb_products }, 1)
+ '1': nb_products - res,
+ '2': nb_products }, 1)
- return res
\ No newline at end of file
+ return res
:return: The text to display for the makeinstall command description.
:rtype: str
'''
- return _("The makeinstall command executes the \"make install\" command in"
- " the build directory.\nIn case of product that is constructed "
- "using a script (build_source : \"script\"), then the "
- "makeinstall command do nothing.\n\nexample:\nsat makeinstall "
- "SALOME-master --products KERNEL,GUI")
+ return _("""\
+The makeinstall command executes the 'make install' command in the build directory.
+In case of product constructed using a script (build_source : 'script'),
+then the makeinstall command do nothing.
+
+example:
+>> sat makeinstall SALOME-master --products KERNEL,GUI""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with makeinstall parameter.
else:
final_status = "KO"
- logger.write(_("\nMake install: %(status)s (%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nMake install: %(status)s (%(1)d/%(2)d)\n") % \
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_products - res,
- 'nb_products': nb_products }, 1)
+ '1': nb_products - res,
+ '2': nb_products }, 1)
- return res
\ No newline at end of file
+ return res
parser.add_option('', 'without_commercial', 'boolean', 'without_commercial',
_('Optional: do not add commercial licence.'), False)
parser.add_option('', 'without_property', 'string', 'without_property',
- _('Optional: Filter the products by their properties.\n\tSyntax: '
- '--without_property <property>:<value>'))
+ _('Optional: Filter the products by their properties.\n'
+ '\tSyntax: --without_property <property>:<value>'))
def add_files(tar, name_archive, d_content, logger, f_exclude=None):
return
del text[num_line +1]
del text[num_line +1]
- text_to_insert =""" import imp
+ text_to_insert ="""\
+ import imp
try:
distene = imp.load_source('distene_licence', '/data/tmpsalome/salome/prerequis/install/LICENSE/dlim8.var.py')
distene.set_distene_variables(context)
except:
- pass\n"""
+ pass
+"""
text.insert(num_line + 1, text_to_insert)
for line in text:
fout.write(line)
and do some substitutions on cmake and .la files (replace the build directories
with local paths).
The procedure to do it is:
- 1) Remove or rename INSTALL directory if it exists
- 2) Execute the shell script install_bin.sh:
- > cd $ROOT
- > ./install_bin.sh
- 3) Use SalomeTool (as explained in Sources section) and compile only the
- modules you need to (with -p option)
+ 1) Remove or rename INSTALL directory if it exists
+ 2) Execute the shell script install_bin.sh:
+ >> cd $ROOT
+ >> ./install_bin.sh
+ 3) Use SalomeTool (as explained in Sources section) and compile only the
+ modules you need to (with -p option)
"""
readme_header_tpl=string.Template(readme_header)
:return: The text to display for the package command description.
:rtype: str
'''
- return _("The package command creates an archive.\nThere are 4 kinds of "
- "archive, which can be mixed:\n 1- The binary archive. It contains all the product "
- "installation directories and a launcher,\n 2- The sources archive."
- " It contains the products archives, a project corresponding to "
- "the application and salomeTools,\n 3- The project archive. It "
- "contains a project (give the project file path as argument),\n 4-"
- " The salomeTools archive. It contains salomeTools.\n\nexample:"
- "\nsat package SALOME-master --bineries --sources")
+ return _("""\
+The package command creates an archive.
+There are 4 kinds of archive, which can be mixed:
+ 1- The binary archive. It contains all the product installation directories and a launcher.
+ 2- The sources archive. It contains the products archives,
+ a project corresponding to the application and salomeTools.
+ 3- The project archive. It contains a project (give the project file path as argument).
+ 4- The salomeTools archive. It contains salomeTools.
+
+example:
+>> sat package SALOME-master --bineries --sources""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with package parameter.
# Check if no option for package type
if all_option_types.count(True) == 0:
- msg = _("Error: Precise a type for the package\nUse one of the "
- "following options: --binaries, --sources, --project or"
- " --salometools")
+ msg = _("ERROR: needs a type for the package\n"
+ " Use one of the following options:\n"
+ " --binaries, --sources, --project or --salometools")
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
return 1
src.check_config_has_application(runner.cfg)
# Display information
- logger.write(_("Packaging application %s\n") % src.printcolors.printcLabel(
- runner.cfg.VARS.application), 1)
+ logger.write(_("Packaging application %s\n") % \
+ src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
# Get the default directory where to put the packages
- package_default_path = os.path.join(runner.cfg.APPLICATION.workdir,
- "PACKAGE")
+ package_default_path = os.path.join(runner.cfg.APPLICATION.workdir, "PACKAGE")
src.ensure_path_exists(package_default_path)
# if the package contains a project:
"data",
"local.pyconf")
msg = _("ERROR: the project %(proj)s is not visible by salomeTools."
- "\nPlease add it in the %(local)s file." % {
- "proj" : options.project, "local" : local_path})
+ "\nPlease add it in the %(local)s file.") % \
+ {"proj" : options.project, "local" : local_path}
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
return 1
archive_name += ("salomeTools_" + runner.cfg.INTERNAL.sat_version)
if len(archive_name)==0: # no option worked
msg = _("Error: Cannot name the archive\n"
- " check if at least one of the following options was "
- "selected : --binaries, --sources, --project or"
+ " check if at least one of the following options was "
+ "selected: --binaries, --sources, --project or"
" --salometools")
logger.write(src.printcolors.printcError(msg), 1)
logger.write("\n", 1)
runner.cfg.VARS.datehour)
src.ensure_path_exists(tmp_working_dir)
logger.write("\n", 5)
- logger.write(_("The temporary working directory: %s\n" % tmp_working_dir),5)
+ logger.write(_("The temporary working directory: %s\n") % tmp_working_dir, 5)
logger.write("\n", 3)
if options.add_files:
for file_path in options.add_files:
if not os.path.exists(file_path):
- msg = _("WARNING: the file %s is not accessible.\n" % file_path)
+ msg = _("WARNING: the file %s is not accessible.\n") % file_path
continue
file_name = os.path.basename(file_path)
d_files_to_add[file_name] = (file_path, file_name)
logger.write('%s: ' % src.printcolors.printcLabel(product_info.name), 4)
logger.write(' ' * (max_product_name_len - len(product_info.name)), 4, False)
logger.write("\n", 4, False)
- msg = _("The %s product is native. Do not apply "
- "any patch.") % product_info.name
+ msg = _("The %s product is native. Do not apply any patch.") % product_info.name
logger.write(msg, 4)
logger.write("\n", 4)
return True, ""
:return: The text to display for the patch command description.
:rtype: str
'''
- return _("The patch command apply the patches on the sources of "
- "the application products if there is any.\n\nexample:\nsat "
- "patch SALOME-master --products qt,boost")
+ return _("""\
+The patch command apply the patches on the sources of the application products
+if there is any.
+
+example:
+>> sat patch SALOME-master --products qt,boost""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with patch parameter.
logger.write(" " + src.printcolors.printc(status), 1, False)
logger.write(" (%s)\n" % res_count, 1, False)
- return len(products_infos) - good_result
\ No newline at end of file
+ return len(products_infos) - good_result
# Define all possible option for prepare command : sat prepare <options>
parser = src.options.Options()
-parser.add_option('p', 'products', 'list2', 'products',
+parser.add_option(
+ 'p', 'products', 'list2', 'products',
_('Optional: products to prepare. This option can be'
' passed several time to prepare several products.'))
-parser.add_option('f', 'force', 'boolean', 'force',
+parser.add_option(
+ 'f', 'force', 'boolean', 'force',
_("Optional: force to prepare the products in development mode."))
-parser.add_option('', 'force_patch', 'boolean', 'force_patch',
+parser.add_option(
+ '', 'force_patch', 'boolean', 'force_patch',
_("Optional: force to apply patch to the products in development mode."))
def get_products_list(options, cfg, logger):
products = options.products
for p in products:
if p not in cfg.APPLICATION.products:
- raise src.SatException(_("Product %(product)s "
- "not defined in application %(application)s") %
- { 'product': p, 'application': cfg.VARS.application} )
+ raise src.SatException(
+ _("Product %(product)s not defined in application %(application)s") %
+ { 'product': p, 'application': cfg.VARS.application} )
# Construct the list of tuple containing
# the products name and their definition
:return: The text to display for the prepare command description.
:rtype: str
'''
- return _("The prepare command gets the sources of "
- "the application products and apply the patches if there is any."
- "\n\nexample:\nsat prepare SALOME-master --products KERNEL,GUI")
+ return _("""\
+The prepare command gets the sources of the application products
+and apply the patches if there is any.
+
+example:
+>> sat prepare SALOME-master --products KERNEL,GUI""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with prepare parameter.
if not options.force and len(ldev_products) > 0:
l_products_not_getted = find_products_already_getted(ldev_products)
if len(l_products_not_getted) > 0:
- msg = _("Do not get the source of the following products "
- "in development mode\nUse the --force option to"
- " overwrite it.\n")
+ msg = _("Do not get the source of the following products in development mode\n"
+ " Use the --force option to overwrite it.\n")
logger.write(src.printcolors.printcWarning(msg), 1)
args_product_opt_clean = remove_products(args_product_opt_clean,
l_products_not_getted,
if not options.force_patch and len(ldev_products) > 0:
l_products_with_patchs = find_products_with_patchs(ldev_products)
if len(l_products_with_patchs) > 0:
- msg = _("do not patch the following products "
- "in development mode\nUse the --force_patch option to"
- " overwrite it.\n")
+ msg = _("do not patch the following products in development mode\n"
+ " Use the --force_patch option to overwrite it.\n")
logger.write(src.printcolors.printcWarning(msg), 1)
args_product_opt_patch = remove_products(args_product_opt_patch,
l_products_with_patchs,
else:
logger.write('%s\n' % src.printcolors.printc(src.KO_STATUS), 5)
- return res_clean + res_source + res_patch
\ No newline at end of file
+ return res_clean + res_source + res_patch
parser = src.options.Options()
-parser.add_option( 'p', 'prefix', 'string', 'prefix', _("Where the profile's "
- "sources will be "
- "generated.") )
-parser.add_option( 'n', 'name', 'string', 'name', _("Name of the profile's "
- "sources. [Default: "
- "${config.PRODUCT.name}"
- "_PROFILE]") )
-parser.add_option( 'f', 'force', 'boolean', 'force', _("Overwrites "
- "existing sources.") )
-parser.add_option( 'u', 'no_update', 'boolean', 'no_update', _("Does not update"
- " pyconf file."))
-parser.add_option( 'v', 'version', 'string', 'version', _("Version of the "
- "application. [Defa"
- "ult: 1.0]"), '1.0' )
-parser.add_option( 's', 'slogan', 'string', 'slogan', _("Slogan of the "
- "application.") )
+parser.add_option(
+ 'p', 'prefix', 'string', 'prefix',
+ _("Where the profile's sources will be generated.") )
+parser.add_option(
+ 'n', 'name', 'string', 'name',
+ _("Name of the profile's sources. [Default: '${config.PRODUCT.name}_PROFILE]") )
+parser.add_option(
+ 'f', 'force', 'boolean', 'force',
+ _("Overwrites existing sources.") )
+parser.add_option(
+ 'u', 'no_update', 'boolean', 'no_update',
+ _("Does not update pyconf file.") )
+parser.add_option(
+ 'v', 'version', 'string', 'version',
+ _("Version of the application. [Default: 1.0]"), '1.0' )
+parser.add_option(
+ 's', 'slogan', 'string', 'slogan',
+ _("Slogan of the application.") )
##################################################
##
# Describes the command
def description():
- return _("The profile command creates default profile.\nusage: sat profile "
- "[PRODUCT] [-p|--prefix (string)] [-n|--name (string)] [-f|--force"
- "] [-v|--version (string)] [-s|--slogan (string)]")
+ return _("""\
+The profile command creates default profile.
+usage:
+>> sat profile [PRODUCT]
+ [-p | --prefix (string)]
+ [-n | --name (string)]
+ [-f | --force]
+ [-v | --version (string)]
+ [-s | --slogan (string)]""")
##
# Gets the profile name
raise src.SatException(_("KERNEL is not installed"))
script = os.path.join(kernel_root_dir,"bin","salome","app-quickstart.py")
if not os.path.exists( script ):
- raise src.SatException(_("KERNEL's install has not the script "
- "app-quickstart.py"))
+ raise src.SatException(
+ _("KERNEL's install has not the script app-quickstart.py") )
# Check that GUI is installed
gui_cfg = src.product.get_product_config(config, "GUI")
if os.path.exists( prefix ) :
if not options.force :
raise src.SatException(
- _("The path %s already exists, use option --force to remove it.") % prefix )
+ _("The path %s already exists, use option --force to remove it.") % prefix )
else :
shutil.rmtree( prefix )
name = name[:-8]
#Write command line that calls app-quickstart.py
- command = "python %s --prefix=%s --name=%s --modules=_NO_ --version=%s" % (
- script, prefix, name, options.version )
+ command = "python %s --prefix=%s --name=%s --modules=_NO_ --version=%s" % \
+ ( script, prefix, name, options.version )
if options.force :
command += " --force"
if options.slogan :
stderr=subprocess.STDOUT)
#Check result of command
if res != 0:
- raise src.SatException(_("Cannot create application, code = %d\n")%res)
+ raise src.SatException(_("Cannot create application, code = %d\n") % res)
else:
- logger.write(_("Profile sources were generated in directory %s.\n"%prefix),
- 3)
+ logger.write(
+ _("Profile sources were generated in directory %s.\n" % prefix), 3 )
return res
##
pyconf = config.VARS.product + '.pyconf'
pyconfBackup = config.VARS.product + '-backup.pyconf'
logger.write(
- _("Updating %(new)s (previous version saved as %(old)s)." ) %
+ _("Updating %(new)s (previous version saved as %(old)s)." ) % \
{ "new": pyconf, "old": pyconfBackup }, 3)
path = config.getPath( pyconf )
shutil.copyfile( os.path.join( path, pyconf ),
prf.addMapping( 'get_source', 'archive', None )
prf.addMapping( 'build_source', 'cmake', None )
prf.addMapping( 'archive_info', src.pyconf.Mapping(), None )
- prf.archive_info.addMapping( 'name',
- os.path.join(os.path.abspath(options.prefix),
- profile ), None )
- prf.addMapping( 'source_dir', src.pyconf.Reference(cfg,
- src.pyconf.DOLLAR,
- 'APPLICATION.workdir'
- ' + $VARS.sep + "SOU'
- 'RCES" + $VARS.sep +'
- ' $name' ), None )
- prf.addMapping( 'build_dir', src.pyconf.Reference(cfg,
- src.pyconf.DOLLAR,
- 'APPLICATION.workdir '
- '+ $VARS.sep + "BUILD'
- '" + $VARS.sep + $nam'
- 'e' ), None )
+ prf.archive_info.addMapping(
+ 'name', os.path.join(os.path.abspath(options.prefix), profile), None )
+ tmp = "APPLICATION.workdir + $VARS.sep + 'SOURCES' + $VARS.sep + $name"
+ prf.addMapping( 'source_dir',
+ src.pyconf.Reference(cfg, src.pyconf.DOLLAR, tmp ),
+ None )
+ tmp = "APPLICATION.workdir + $VARS.sep + 'BUILD' + $VARS.sep + $name"
+ prf.addMapping( 'build_dir',
+ src.pyconf.Reference(cfg, src.pyconf.DOLLAR, tmp ),
+ None )
prf.addMapping( 'depend', src.pyconf.Sequence(), None )
prf.depend.append( 'KERNEL', None )
prf.depend.append( 'GUI', None )
for p in products:
if p not in cfg.APPLICATION.products:
raise src.SatException(_("Product %(product)s "
- "not defined in application %(application)s") %
+ "not defined in application %(application)s") % \
{ 'product': p, 'application': cfg.VARS.application} )
# Construct the list of tuple containing
logger.flush()
# Do nothing if he product is not compilable or has no compilation script
- if (("properties" in p_info and "compilation" in p_info.properties and
- p_info.properties.compilation == "no") or
- (not src.product.product_has_script(p_info))):
+ if ( ("properties" in p_info and
+ "compilation" in p_info.properties and
+ p_info.properties.compilation == "no") or
+ (not src.product.product_has_script(p_info)) ):
log_step(logger, header, "ignored")
logger.write("\n", 3, False)
return 0
if res > 0:
logger.write("\r%s%s" % (header, " " * len_end_line), 3)
logger.write("\r" + header + src.printcolors.printcError("KO"))
- logger.write("==== %(KO)s in script execution of %(name)s \n" %
+ logger.write("==== %(KO)s in script execution of %(name)s \n" % \
{ "name" : p_name , "KO" : src.printcolors.printcInfo("ERROR")}, 4)
logger.flush()
else:
logger.write("\r%s%s" % (header, " " * len_end_line), 3)
logger.write("\r" + header + src.printcolors.printcSuccess("OK"))
logger.write("==== %s \n" % src.printcolors.printcInfo("OK"), 4)
- logger.write("==== Script execution of %(name)s %(OK)s \n" %
+ logger.write("==== Script execution of %(name)s %(OK)s \n" % \
{ "name" : p_name , "OK" : src.printcolors.printcInfo("OK")}, 4)
logger.flush()
logger.write("\n", 3, False)
:return: The text to display for the script command description.
:rtype: str
'''
- return _("The script command executes the script(s) of the the given "
- "products in the build directory.\nThis is done only for the "
- "products that are constructed using a script (build_source "
- ": \"script\").\nOtherwise, nothing is done."
- "\n\nexample:\nsat script SALOME-master --products Python,numpy")
+ return _("""\
+The script command executes the script(s) of the the given products in the build directory.
+ This is done only for the products that are constructed using a script (build_source : 'script').
+ Otherwise, nothing is done.
+
+ example:
+ >> sat script SALOME-master --products Python,numpy
+""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with make parameter.
products_infos = get_products_list(options, runner.cfg, logger)
# Print some informations
- logger.write(_('Executing the script in the build '
- 'directories of the application %s\n') %
- src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
+ msg = ('Executing the script in the build directories of the application %s\n') % \
+ src.printcolors.printcLabel(runner.cfg.VARS.application)
+ logger.write(msg, 1)
- info = [(_("BUILD directory"),
- os.path.join(runner.cfg.APPLICATION.workdir, 'BUILD'))]
+ info = [(_("BUILD directory"), os.path.join(runner.cfg.APPLICATION.workdir, 'BUILD'))]
src.print_info(logger, info)
# Call the function that will loop over all the products and execute
else:
final_status = "KO"
- logger.write(_("\nScript: %(status)s "
- "(%(valid_result)d/%(nb_products)d)\n") % \
+ logger.write(_("\nScript: %(status)s (%(1)d/%(2)d)\n") % \
{ 'status': src.printcolors.printc(final_status),
- 'valid_result': nb_products - res,
- 'nb_products': nb_products }, 1)
+ '1': nb_products - res,
+ '2': nb_products }, 1)
- return res
\ No newline at end of file
+ return res
:return: The text to display for the shell command description.
:rtype: str
'''
- return _("Executes the shell command passed as argument.\n\nexample:"
- "\nsat shell --command \"ls \\-l /tmp\"")
+ return _("""\
+Executes the shell command passed as argument.
+example:
+>> sat shell --command 'ls -l /tmp'""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with shell parameter.
return 1
# Print the input command
- msg = _("Command to execute:\n%s\nExecution ... " % options.command)
+ msg = _("Command to execute:\n%s\nExecution ... ") % options.command
logger.write(msg, 3)
# Call the input command
logger.write("\n",3)
- return res
\ No newline at end of file
+ return res
# +2 because product name is followed by ': '
logger.write(" " * (pad+2), 3, False)
- logger.write('dev: %s ... ' %
+ logger.write('dev: %s ... ' % \
src.printcolors.printcInfo(product_info.source_dir), 3, False)
logger.flush()
'''
# check archive exists
if not os.path.exists(product_info.archive_info.archive_name):
- raise src.SatException(_("Archive not found: '%s'") %
+ raise src.SatException(_("Archive not found: '%s'") % \
product_info.archive_info.archive_name)
- logger.write('arc:%s ... ' %
+ logger.write('arc:%s ... ' % \
src.printcolors.printcInfo(product_info.archive_info.archive_name),
- 3,
- False)
+ 3, False)
logger.flush()
# Call the system function that do the extraction in archive mode
retcode, NameExtractedDirectory = src.system.archive_extract(
def get_source_from_dir(product_info, source_dir, logger):
if "dir_info" not in product_info:
- msg = _("Error: you must put a dir_info section"
- " in the file %s.pyconf" % product_info.name)
+ msg = _("Error: you must put a dir_info section in the file %s.pyconf") % \
+ product_info.name
logger.write("\n%s\n" % src.printcolors.printcError(msg), 1)
return False
if "dir" not in product_info.dir_info:
- msg = _("Error: you must put a dir in the dir_info section"
- " in the file %s.pyconf" % product_info.name)
+ msg = _("Error: you must put a dir in the dir_info section in the file %s.pyconf") % \
+ product_info.name
logger.write("\n%s\n" % src.printcolors.printcError(msg), 1)
return False
# check that source exists
if not os.path.exists(product_info.dir_info.dir):
- msg = _("""\
-Error: the dir '%(1)s' defined in the file"
- %(2)s.pyconf does not exists""" %
- {"1": product_info.dir_info.dir, "2": product_info.name})
+ msg = _("ERROR: the dir '%(1)s' defined in the file %(2)s.pyconf does not exists") % \
+ {"1": product_info.dir_info.dir, "2": product_info.name}
logger.write("\n%s\n" % src.printcolors.printcError(msg), 1)
return False
if checkout: coflag = src.printcolors.printcHighlight(coflag.upper())
logger.write('%s:%s' % (coflag, src.printcolors.printcInfo(cvs_line)),
- 3,
- False)
+ 3, False)
logger.write(' ' * (pad + 50 - len(cvs_line)), 3, False)
- logger.write(' src:%s' %
- src.printcolors.printcInfo(product_info.cvs_info.source),
- 3,
- False)
+ logger.write(' src:%s' % src.printcolors.printcInfo(product_info.cvs_info.source),
+ 3, False)
logger.write(' ' * (pad + 1 - len(product_info.cvs_info.source)), 3, False)
- logger.write(' tag:%s' %
- src.printcolors.printcInfo(product_info.cvs_info.tag),
- 3,
- False)
+ logger.write(' tag:%s' % src.printcolors.printcInfo(product_info.cvs_info.tag),
+ 3, False)
# at least one '.' is visible
logger.write(' %s. ' % ('.' * (10 - len(product_info.cvs_info.tag))),
- 3,
- False)
+ 3, False)
logger.flush()
logger.write('\n', 5, False)
coflag = 'svn'
if checkout: coflag = src.printcolors.printcHighlight(coflag.upper())
- logger.write('%s:%s ... ' % (coflag,
- src.printcolors.printcInfo(
- product_info.svn_info.repo)),
- 3,
- False)
+ logger.write('%s:%s ... ' % (coflag, src.printcolors.printcInfo(product_info.svn_info.repo)),
+ 3, False)
logger.flush()
logger.write('\n', 5, False)
# Call the system function that do the extraction in svn mode
logger.write('%s ' % src.printcolors.printc(src.OK_STATUS),
3,
False)
- msg = _('INFORMATION : Not doing anything because the product'
- ' is of type "native".\n')
+ msg = _("INFORMATION : do nothing because the product is of type 'native'.\n")
logger.write(msg, 3)
return True
logger.write('%s ' % src.printcolors.printc(src.OK_STATUS),
3,
False)
- msg = _('INFORMATION : Not doing anything because the product'
- ' is of type "fixed".\n')
+ msg = _("INFORMATION : do nothing because the product is of type 'fixed'.\n")
logger.write(msg, 3)
return True
# if the get_source is not in [git, archive, cvs, svn, fixed, native]
- logger.write(_("Unknown get source method \"%(get)s\" for product %(product)s") % \
- { 'get': product_info.get_source, 'product': product_info.name }, 3, False)
+ logger.write(_("Unknown get source method '%(get)s' for product %(product)s") % \
+ {'get': product_info.get_source, 'product': product_info.name},
+ 3, False)
logger.write(" ... ", 3, False)
logger.flush()
return False
check_OK, wrong_path = check_sources(product_info, logger)
if not check_OK:
# Print the missing file path
- msg = _("The required file %s does not exists. " % wrong_path)
+ msg = _("The required file %s does not exists. ") % wrong_path
logger.write(src.printcolors.printcError("\nERROR: ") + msg, 3)
retcode = False
src.check_config_has_application( runner.cfg )
# Print some informations
- logger.write(_('Getting sources of the application %s\n') %
+ logger.write(_('Getting sources of the application %s\n') % \
src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
src.printcolors.print_value(logger, 'workdir',
runner.cfg.APPLICATION.workdir, 2)
parser = src.options.Options()
parser.add_option('n', 'name', 'string', 'name',
- _("""REQUIRED: the name of the module to create.
-\tThe name must be a single word in upper case with only alphanumeric characters.
-\tWhen generating a c++ component the module's """
-"""name must be suffixed with 'CPP'."""))
+ _("""\
+REQUIRED: the name of the module to create.
+ The name must be a single word in upper case with only alphanumeric characters.
+ When generating a c++ component the module's name must be suffixed with 'CPP'."""))
parser.add_option('t', 'template', 'string', 'template',
_('REQUIRED: the template to use.'))
parser.add_option('', 'target', 'string', 'target',
_('REQUIRED: where to create the module.'))
parser.add_option('', 'param', 'string', 'param',
- _('''Optional: dictionary to generate the configuration for salomeTools.
-\tFormat is: --param param1=value1,param2=value2... without spaces
-\tNote that when using this option you must supply all the '''
-'''values otherwise an error will be raised.'''))
+ _("""\
+Optional: dictionary to generate the configuration for salomeTools.
+ Format is: --param param1=value1,param2=value2... (without spaces).
+ Note that when using this option you must supply all the values,
+ otherwise an error will be raised.""") )
parser.add_option('', 'info', 'boolean', 'info',
_('Optional: Get information on the template.'), False)
for pp in ["file_subst", "parameters"]:
if not ldic.has_key(pp): missing.append("'%s'" % pp)
if len(missing) > 0:
- raise src.SatException(_(
- "Bad format in settings file! %s not defined.") % ", ".join(
- missing))
+ raise src.SatException(
+ _("Bad format in settings file! %s not defined.") % \
+ ", ".join(missing) )
self.file_subst = ldic["file_subst"]
self.parameters = ldic['parameters']
missing.append(p)
if len(missing) > 0:
- raise src.SatException(_(
- "Missing parameters: %s") % ", ".join(missing))
+ raise src.SatException(
+ _("Missing parameters: %s") % ", ".join(missing) )
def get_parameters(self, conf_values=None):
if self.dico is not None:
ff = fic.replace(tsettings.file_subst, compo_name)
if ff != fic:
if os.path.exists(os.path.join(root, ff)):
- raise src.SatException(_(
- "Destination file already exists: %s") % os.path.join(
- root, ff))
+ raise src.SatException(
+ _("Destination file already exists: %s") % \
+ os.path.join(root, ff) )
logger.write(" %s -> %s\n" % (fic, ff), 5)
os.rename(os.path.join(root, fic), os.path.join(root, ff))
dd = rep.replace(tsettings.file_subst, compo_name)
if dd != rep:
if os.path.exists(os.path.join(root, dd)):
- raise src.SatException(_(
- "Destination directory "
- "already exists: %s") % os.path.join(root, dd))
+ raise src.SatException(
+ _("Destination directory already exists: %s") % \
+ os.path.join(root, dd) )
logger.write(" %s -> %s\n" % (rep, dd), 5)
os.rename(os.path.join(root, rep), os.path.join(root, dd))
zz = list(set(zz)) # reduce
zz = filter(lambda l: l not in pnames, zz)
if len(zz) > 0:
- logger.write("Missing definition in %s: %s" % (
- src.printcolors.printcLabel(
- fpath[pathlen:]), ", ".join(zz)), 3)
+ logger.write("Missing definition in %s: %s" % \
+ ( src.printcolors.printcLabel(fpath[pathlen:]), ", ".join(zz) ), 3)
retcode = 1
if retcode == 0:
##
# Describes the command
def description():
- return _("The template command creates the sources for a SALOME "
- "module from a template.\n\nexample\nsat template "
- "--name my_product_name --template PythonComponent --target /tmp")
+ return _("""\
+The template command creates the sources for a SALOME module from a template.
+
+example:
+>> sat template --name my_product_name --template PythonComponent --target /tmp""")
def run(args, runner, logger):
'''method that is called when salomeTools is called with template parameter.
# Define all possible option for the test command : sat test <options>
parser = src.options.Options()
parser.add_option('b', 'base', 'string', 'base',
- _("Optional: Indicate the name of the test base to use.\n\tThis name has to"
- " be registered in your application and in a project.\n\tA path to a "
- "test base can also be used."))
+ _("""\
+Optional: Indicate the name of the test base to use.
+ This name has to be registered in your application and in a project.
+ A path to a test base can also be used."""))
parser.add_option('l', 'launcher', 'string', 'launcher',
_("Optional: Use this option to specify the path to a SALOME launcher to "
"use to launch the test scripts of the test base."))
parser.add_option('g', 'grid', 'list', 'grids',
- _('Optional: Indicate which grid(s) to test (subdirectory of the test '
- 'base).'))
+ _('Optional: Indicate which grid(s) to test (subdirectory of the test base).'))
parser.add_option('s', 'session', 'list', 'sessions',
- _('Optional: indicate which session(s) to test (subdirectory of the '
- 'grid).'))
+ _('Optional: indicate which session(s) to test (subdirectory of the grid).'))
parser.add_option('', 'display', 'string', 'display',
- _("Optional: set the display where to launch SALOME.\n"
-"\tIf value is NO then option --show-desktop=0 will be used to launch SALOME."))
+ _("""\
+Optional: set the display where to launch SALOME.
+ If value is NO then option --show-desktop=0 will be used to launch SALOME."""))
def description():
'''method that is called when salomeTools is called with --help option.
:return: The text to display for the test command description.
:rtype: str
'''
- return _("The test command runs a test base on a SALOME installation.\n\n"
- "example:\nsat test SALOME-master --grid GEOM --session light")
+ return _("""\
+The test command runs a test base on a SALOME installation.
+example:
+>> sat test SALOME-master --grid GEOM --session light""")
def parse_option(args, config):
""" Parse the options and do some verifications about it
options.launcher = ""
elif not os.path.isabs(options.launcher):
if not src.config_has_application(config):
- raise src.SatException(_("An application is required to use a "
- "relative path with option --appli"))
- options.launcher = os.path.join(config.APPLICATION.workdir,
- options.launcher)
+ raise src.SatException(
+ _("An application is required to use a relative path with option --appli") )
+ options.launcher = os.path.join(config.APPLICATION.workdir, options.launcher)
if not os.path.exists(options.launcher):
- raise src.SatException(_("Launcher not found: %s") %
- options.launcher)
+ raise src.SatException(
+ _("Launcher not found: %s") % options.launcher )
return (options, args)
logger.write("\n", 3, False)
def check_remote_machine(machine_name, logger):
- logger.write(_("\ncheck the display on %s\n" % machine_name), 4)
+ logger.write(_("\ncheck the display on %s\n") % machine_name, 4)
ssh_cmd = 'ssh -o "StrictHostKeyChecking no" %s "ls"' % machine_name
- logger.write(_("Executing the command : %s " % ssh_cmd), 4)
+ logger.write(_("Executing the command : %s ") % ssh_cmd, 4)
p = subprocess.Popen(ssh_cmd,
shell=True,
stdin =subprocess.PIPE,
if p.returncode != 0:
logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 1)
logger.write(" " + src.printcolors.printcError(p.stderr.read()), 2)
- logger.write(src.printcolors.printcWarning((
- "No ssh access to the display machine.")),1)
+ logger.write(src.printcolors.printcWarning(
+ _("No ssh access to the display machine.")), 1)
else:
logger.write(src.printcolors.printcSuccess(src.OK_STATUS) + "\n\n", 4)
# the test base is specified either by the application, or by the --base option
with_application = False
if runner.cfg.VARS.application != 'None':
- logger.write(_('Running tests on application %s\n') %
- src.printcolors.printcLabel(
- runner.cfg.VARS.application), 1)
+ logger.write(
+ _('Running tests on application %s\n') %
+ src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
with_application = True
elif not options.base:
raise src.SatException(
logger.write(src.printcolors.printcWarning(
_("Running SALOME application.")) + "\n\n", 1)
else:
- msg = _("Impossible to find any launcher.\nPlease specify an "
- "application or a launcher")
+ msg = _("Impossible to find any launcher.\n"
+ "Please specify an application or a launcher")
logger.write(src.printcolors.printcError(msg))
logger.write("\n")
return 1
try:
shutil.rmtree(tmp_dir)
except:
- logger.error(_("error removing TT_TMP_RESULT %s\n")
- % tmp_dir)
+ logger.error(
+ _("error removing TT_TMP_RESULT %s\n") % tmp_dir)
lines = []
lines.append("date = '%s'" % runner.cfg.VARS.date)
# Add the historic files into the log files list of the command
logger.l_logFiles.append(historic_xml_path)
- logger.write(_("Removing the temporary directory: "
- "rm -rf %s\n" % test_runner.tmp_working_dir), 5)
+ logger.write(
+ _("Removing the temporary directory: %s\n" %
+ test_runner.tmp_working_dir), 5 )
if os.path.exists(test_runner.tmp_working_dir):
shutil.rmtree(test_runner.tmp_working_dir)
sys.path.append(cmdsdir)
import config
+import src.debug as DBG
# load resources for internationalization
#es = gettext.translation('salomeTools', os.path.join(satdir, 'src', 'i18n'))
sys.stderr.write(src.printcolors.printcError("salomeTools ERROR:"))
sys.stderr.write("\n" + str(exc) + "\n")
+
# ###############################
# MAIN : terminal command usage #
# ###############################
# Initialize the code that will be returned by the terminal command
code = 0
(options, args) = parser.parse_args(sys.argv[1:])
-
+ DBG.push_debug(True)
+ DBG.write("options", options)
+ DBG.write("args", args)
+
# no arguments : print general help
if len(args) == 0:
print_help()
sat = Sat(sys.argv[1:])
# the command called
command = args[0]
+ DBG.write("command", command)
# get dynamically the command function to call
fun_command = sat.__getattr__(command)
+ DBG.write("fun_command", fun_command)
# Run the command using the arguments
code = fun_command(args[1:])
-
+ DBG.write("code", code)
+
# exit salomeTools with the right code (0 if no errors, else 1)
if code is None: code = 0
sys.exit(code)
import shutil
import errno
import stat
+import platform
-from . import pyconf
-from . import architecture
-from . import printcolors
-from . import options
-from . import system
-from . import ElementTree
-from . import logger
-from . import product
-from . import environment
-from . import fileEnviron
-from . import compilation
-from . import test_module
-from . import template
+import pyconf
+import architecture
+import printcolors
+import options
+import system
+import ElementTree
+import logger
+import product
+import environment
+import fileEnviron
+import compilation
+import test_module
+import template
-import platform
if platform.system() == "Windows" :
import colorama
colorama.init()
local_file_path = os.path.join(config.VARS.salometoolsway,
"data",
"local.pyconf")
- msg = _("Please define a base path in the file %s" % local_file_path)
+ msg = _("Please define a base path in the file %s") % local_file_path
raise SatException(msg)
base_path = os.path.abspath(config.LOCAL.base)
local_file_path = os.path.join(config.VARS.salometoolsway,
"data",
"local.pyconf")
- msg = _("Please define a log_dir in the file %s" % local_file_path)
+ msg = _("Please define a log_dir in the file %s") % local_file_path
raise SatException(msg)
log_dir_path = os.path.abspath(config.LOCAL.log_dir)
try:
cfg_file = pyconf.Config(filePath)
except pyconf.ConfigError as e:
- raise SatException(_("Error in configuration file: %(file)s\n %(error)s") % \
- { 'file': filePath, 'error': str(e) })
+ raise SatException(_("Error in configuration file: %(file)s\n %(error)s") %
+ { 'file': filePath, 'error': str(e) } )
return cfg_file
def get_tmp_filename(cfg, name):
on which SAT is running
'''
-import os, sys, platform
+import os
+import sys
+import platform
def is_windows():
'''method that checks windows OS
# Performs a build with a script.
def do_python_script_build(self, script, nb_proc):
# script found
- self.logger.write(_("Compile %(product)s using script %(script)s\n") % \
+ self.logger.write(_("Compile %(product)s using script %(script)s\n") %
{ 'product': self.product_info.name,
- 'script': src.printcolors.printcLabel(script) }, 4)
+ 'script': src.printcolors.printcLabel(script) }, 4)
try:
import imp
product = self.product_info.name
if extension == "py":
return self.do_python_script_build(script, nb_proc)
- msg = _("The script %s must have .sh, .bat or .py extension." % script)
+ msg = _("The script %s must have .sh, .bat or .py extension.") % script
raise src.SatException(msg)
def put_txt_log_in_appli_log_dir(self, file_name):
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+'''This file is to assume print debug messages sys.stderr for salomeTools
+warning: only for SAT development phase
+'''
+
+import sys
+import pprint as PP
+
+_debug = [True] #support push/pop for temporary active outputs
+
+def write(title, var=""):
+ if _debug[-1]:
+ sys.stderr.write("\n#### DEBUG: %s:\n%s\n" % (title, PP.pformat(var)))
+ return
+
+def push_debug(aBool):
+ """set debug outputs activated, or not"""
+ _debug.append(aBool)
+
+def pop_debug():
+ """restore previous debug outputs status"""
+ if len(_debug) > 1:
+ return _debug.pop()
+ else:
+ sys.stderr.write("\n#### DEBUG: ERROR: too much pop_debug()")
+ return None
try:
value = zt.substitute(self.environ)
except KeyError as exc:
- raise src.SatException(_("Missing definition "
- "in environment: %s") % str(exc))
+ raise src.SatException(
+ _("Missing definition in environment: %s") % str(exc) )
return value
def append_value(self, key, value, sep=os.pathsep):
env_script = product_info.environ.env_script
# Check that the script exists
if not os.path.exists(env_script):
- raise src.SatException(_("Environment script not found: %s") %
- env_script)
+ raise src.SatException(
+ _("Environment script not found: %s") % env_script)
if not self.silent and logger is not None:
logger.write(" ** load %s\n" % env_script, 4)
return
# Check that the script exists
if not os.path.exists(script_path):
- raise src.SatException(_("Environment script not found: %s") %
- script_path)
+ raise src.SatException(
+ _("Environment script not found: %s") % script_path)
if not self.silent and logger is not None:
logger.write(" ** load %s\n" % script_path, 4)
poFile=$I18HOME/fr/LC_MESSAGES/salomeTools.po
refFile=$I18HOME/fr/LC_MESSAGES/ref.pot
+cp ${poFile} ${poFile}_old
+
xgettext $SRC_DIR/src/i18n/*.py \
$SRC_DIR/*.py \
$SRC_DIR/commands/*.py \
--no-location \
--language=Python \
--omit-header \
- --output=$refFile
+ --output=${refFile}
msgmerge --quiet --update --previous $poFile $refFile
#msgattrib --no-obsolete -o $poFile $poFile
#ne pas retirer les messages obsolètes « #~ »
-msgattrib --previous --output-file $poFile $poFile
+msgattrib --previous --output-file ${poFile} ${poFile}
rm $refFile
+echo "Do translate stuff please..."
+meld ${poFile} ${poFile}_old
+
echo "Do not forget 'translate.py' or 'translate.sh' to create salomeTools.mo"
"Here is the error:"
msgstr ""
-#, python-format
-msgid "Hook script not found: %s"
-msgstr ""
-
-msgid "Run hook script"
-msgstr ""
-
-#, python-format
-msgid "Unable to run hook script: %s"
-msgstr ""
-
-#, python-format
-msgid "Command '%s' does not exist"
-msgstr ""
-
-msgid "Description:"
-msgstr ""
-
-msgid "Version: "
-msgstr ""
-
-msgid "Usage: "
-msgstr "Utilisation : "
-
-msgid "Available commands are:\n"
-msgstr "Les commandes disponibles sont:\n"
-
-msgid ""
-"\n"
-"Getting the help for a specific command: "
-msgstr ""
-"\n"
-"Obtenir l'aide d'une commande spécifique : "
-
-msgid ""
-"Optional: The name of the application (default is APPLICATION.virtual_app."
-"name or runAppli)"
-msgstr ""
-
-msgid "Optional: The resources catalog to use"
-msgstr ""
-
-msgid ""
-"Optional: The directory where to create the application (default is "
-"APPLICATION.workdir)"
-msgstr ""
-
-msgid ""
-"Optional: Create a resources catalog for the specified machines (separated "
-"with ',')\n"
-"\tNOTICE: this command will ssh to retrieve information to each machine in "
-"the list"
-msgstr ""
-
-msgid ""
-"Optional: the restricted list of module(s) to include in the application"
-msgstr ""
-
-#, python-format
-msgid "Cannot create the alias '%s'\n"
-msgstr ""
-
-#, python-format
-msgid "WARNING: module %s not installed"
-msgstr ""
-
-#, fuzzy
-msgid "KERNEL is not installed"
-msgstr "lsb_release n'est pas installé\n"
-
-#, python-format
-msgid "Cannot create application, code = %d\n"
-msgstr ""
-
-#, python-format
-msgid "WARNING: module %s is required to create application\n"
-msgstr ""
-
-msgid "To launch the application, type:\n"
-msgstr ""
-
-#, python-format
-msgid "Catalog not found: %s"
-msgstr ""
-
-msgid "Creating environment files"
-msgstr ""
-
-msgid "Building application"
-msgstr ""
-
-msgid "Generate Resources Catalog"
-msgstr ""
-
-msgid ""
-"The application command creates a SALOME application.\n"
-"WARNING: it works only for SALOME 6. Use the \"launcher\" command for newer "
-"versions of SALOME\n"
-"\n"
-"example:\n"
-"sat application SALOME-6.6.0"
-msgstr ""
-
-#, python-format
-msgid "Building application for %s\n"
-msgstr ""
-
-msgid "The section APPLICATION.virtual_app is not defined in the product."
-msgstr ""
-
-msgid "Application directory"
-msgstr ""
-
-msgid "Resources Catalog"
-msgstr ""
-
-msgid "Removing previous application directory"
-msgstr ""
-
-msgid ""
-"Optional: products to configure. This option can be passed several time to "
-"configure several products."
-msgstr ""
-
-#, python-format
-msgid "Product %(1)s not defined in application %(2)s"
-msgstr ""
-
-#, python-format
-msgid "Check of %s"
-msgstr ""
-
-#, python-format
-msgid "The product %s is defined as not having tests. product ignored."
-msgstr ""
-
-#, python-format
-msgid "No build_dir key defined in the config file of %s: product ignored."
-msgstr ""
-
-#, python-format
-msgid "The product %s is defined as not compiling. product ignored."
-msgstr ""
-
-msgid ""
-"WARNING: The product %(name)s is defined as having tests.\n"
-" But it is compiled using a script and the key 'test_build'\n"
-" is not defined in the definition of %(name)"
-msgstr ""
-
-msgid ""
-"The check command executes the \"check\" command in the build directory of "
-"all the products of the application.\n"
-"It is possible to reduce the list of products to check by using the --"
-"products option\n"
-"\n"
-"example\n"
-"sat check SALOME-master --products KERNEL,GUI,GEOM"
-msgstr ""
-
-#, python-format
-msgid ""
-"Executing the check command in the build directories of the application %s\n"
-msgstr ""
-
-msgid "BUILD directory"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Check: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid ""
-"Optional: Products to clean. This option can be passed several time to clean "
-"several products."
-msgstr ""
-
-msgid ""
-"Optional: Filter the products by their properties.\n"
-"\tSyntax: --properties <property>:<value>"
-msgstr ""
-
-msgid "Optional: Clean the product source directories."
-msgstr ""
-
-msgid "Optional: Clean the product build directories."
-msgstr ""
-
-msgid "Optional: Clean the product install directories."
-msgstr ""
-
-msgid "Optional: Clean the product source, build and install directories."
-msgstr ""
-
-msgid "Optional: do not clean the products in development mode."
-msgstr ""
-
-#, python-format
-msgid "Product %(product)s not defined in application %(application)s"
-msgstr ""
-
-#, python-format
-msgid "WARNING: the path %s does not exists (or is not a directory)\n"
-msgstr ""
-
-#, python-format
-msgid "Removing %s ..."
-msgstr ""
-
-msgid ""
-"The clean command suppress the source, build, or install directories of the "
-"application products.\n"
-"Use the options to define what directories you want to suppress and to "
-"reduce the list of products\n"
-"\n"
-"example:\n"
-"sat clean SALOME-master --build --install --properties is_salome_module:yes"
-msgstr ""
-
-msgid ""
-"WARNING: the \"--properties\" options must have the following syntax:\n"
-"--properties <property>:<value>"
-msgstr ""
-
-msgid "Nothing to suppress\n"
-msgstr ""
-
-#, python-format
-msgid "Please specify what you want to suppress: tap \"%s\"\n"
-msgstr ""
-
-msgid "Remove the following directories ?\n"
-msgstr ""
-
-msgid "Are you sure you want to continue? [Yes/No] "
-msgstr ""
-
-msgid "YES"
-msgstr ""
-
-msgid ""
-"Optional: build all necessary products to the given product (KERNEL is build "
-"before building GUI)."
-msgstr ""
-
-msgid ""
-"Optional: build all products using the given product (all SMESH plugins are "
-"build after SMESH)."
-msgstr ""
-
-msgid "Optional: clean BUILD dir and INSTALL dir before building product."
-msgstr ""
-
-msgid "Optional: clean INSTALL dir before building product."
-msgstr ""
-
-msgid "Optional: add extra options to the 'make' command."
-msgstr ""
-
-msgid "Optional: DO NOT COMPILE just show if products are installed or not."
-msgstr ""
-
-msgid "Optional: Stops the command at first product compilation fail."
-msgstr ""
-
-msgid "Optional: execute the unit tests after compilation"
-msgstr ""
-
-msgid "Optional: remove the build directory after successful compilation"
-msgstr ""
-
-#, python-format
-msgid ""
-"The product %(child_name)s that is in %(product_name)s children is not "
-"present in application %(appli_name)s"
-msgstr ""
-
-#, python-format
-msgid ""
-"The product %(father_name)s that is in %(product_name)s dependencies is not "
-"present in application %(appli_name)s"
-msgstr ""
-
-#, python-format
-msgid "Compilation of %s"
-msgstr ""
-
-#, fuzzy
-msgid "Already installed\n"
-msgstr "lsb_release n'est pas installé\n"
-
-#, fuzzy
-msgid "Not installed\n"
-msgstr "lsb_release n'est pas installé\n"
-
-msgid "ERROR : the following product(s) is(are) mandatory: "
-msgstr ""
-
-msgid "Cleaning the install directory if there is any\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"INSTALL directory = %s"
-msgstr ""
-
-msgid ""
-"Error: despite the fact that all the steps ended successfully, no install "
-"directory was found !"
-msgstr ""
-
-msgid "Add the config file in installation directory\n"
-msgstr ""
-
-msgid ""
-"The compile command constructs the products of the application\n"
-"\n"
-"example:\n"
-"sat compile SALOME-master --products KERNEL,GUI,MEDCOUPLING --clean_all"
-msgstr ""
-
-msgid ""
-"You used --clean_all without specifying a product are you sure you want to "
-"continue? [Yes/No] "
-msgstr ""
-
-#, python-format
-msgid ""
-"Executing the compile commands in the build directories of the products of "
-"the application %s\n"
-msgstr ""
-
-msgid "SOURCE directory"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Compilation: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid "Optional: print the value of CONFIG_VARIABLE."
-msgstr ""
-
-msgid "Optional: edit the product configuration file."
-msgstr ""
-
-msgid "Optional: get information on a product."
-msgstr ""
-
-msgid "Optional: list all available applications."
-msgstr ""
-
-msgid "Optional: synthetic view of all patches used in the application"
-msgstr ""
-
-msgid ""
-"Optional: copy a config file to the personal config files directory.\n"
-"\tWARNING the included files are not copied.\n"
-"\tIf a name is given the new config file takes the given name."
-msgstr ""
-
-msgid "Internal use: do not print labels, Works only with --value and --list."
-msgstr ""
-
-msgid "Internal use: print only keys, works only with --value."
-msgstr ""
-
-msgid "Internal use."
-msgstr ""
-
-#, python-format
-msgid "Configuration file '%s' not found"
-msgstr ""
-
-#, python-format
-msgid ""
-"Error in configuration file: salomeTools.pyconf\n"
-" %(error)s"
-msgstr ""
-
-#, python-format
-msgid ""
-"Error in configuration file: local.pyconf\n"
-" %(error)s"
-msgstr ""
-
-#, python-format
-msgid "WARNING: The project file %s cannot be found. It will be ignored\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"ERROR: Error in configuration file: %(file_path)s\n"
-" %(error)s\n"
-msgstr ""
-
-#, python-format
-msgid "%s, use 'config --list' to get the list of available applications."
-msgstr ""
-
-#, python-format
-msgid ""
-"Error in configuration file: %(application)s.pyconf\n"
-" %(error)s"
-msgstr ""
-
-#, python-format
-msgid "Error in configuration file: %(application)s.pyconf\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"WARNING: Error in configuration file: %(prod)s\n"
-" %(error)s"
-msgstr ""
-
-msgid "Error in get_user_config_file: missing user config file path"
-msgstr ""
-
-msgid "** not found"
-msgstr ""
-
-msgid "** bad extension"
-msgstr ""
-
-#, python-format
-msgid "%s is a product\n"
-msgstr ""
-
-msgid "no install dir"
-msgstr ""
-
-msgid "This product does not compile"
-msgstr ""
-
-msgid ""
-"The config command allows manipulation and operation on config files.\n"
-"\n"
-"example:\n"
-"sat config SALOME-master --info ParaView"
-msgstr ""
-
-#, python-format
-msgid "Openning %s\n"
-msgstr ""
-
-#, python-format
-msgid "%(product_name)s is not a product of %(application_name)s."
-msgstr ""
-
-#, python-format
-msgid "Config file for product %s not found\n"
-msgstr ""
-
-#, python-format
-msgid "A personal application '%s' already exists"
-msgstr ""
-
-#, python-format
-msgid "%s has been created.\n"
-msgstr ""
-
-msgid "Directory not found"
-msgstr ""
-
-#, python-format
-msgid "Show the patchs of application %s\n"
-msgstr ""
-
-msgid "Optional: Option to add to the configure or cmake command."
-msgstr ""
-
-#, python-format
-msgid "Configuration of %s"
-msgstr ""
-
-msgid ""
-"The configure command executes in the build directory the configure commands "
-"corresponding\n"
-"to the compilation mode of the application products.\n"
-"The possible compilation modes are \"cmake\", \"autotools\", or a script.\n"
-"\n"
-"Here are the commands to be run :\n"
-"autotools: build_configure and configure\n"
-"cmake: cmake\n"
-"script: do nothing\n"
-"\n"
-"example:\n"
-"sat configure SALOME-master --products KERNEL,GUI,PARAVIS"
-msgstr ""
-
-#, python-format
-msgid "Configuring the sources of the application %s\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Configuration: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid ""
-"Optional: Generates the environment files for the given format: bash "
-"(default), bat (for windows), cfg (salome context file) or all."
-msgstr ""
-
-msgid "Optional: Includes only the specified products."
-msgstr ""
-
-msgid "Optional: Specifies the prefix for the environment files."
-msgstr ""
-
-msgid ""
-"Optional: Specifies the directory path where to put the environment files."
-msgstr ""
-
-#, python-format
-msgid "Target directory not found: %s"
-msgstr ""
-
-#, python-format
-msgid "Creating environment files for %s\n"
-msgstr ""
-
-msgid "Target"
-msgstr ""
-
-#, fuzzy, python-format
-msgid "Unknown shell: %s\n"
-msgstr "Architecture inconnue: '%s'\n"
-
-msgid ""
-"The environ command generates the environment files of your application.\n"
-"\n"
-"example:\n"
-"sat environ SALOME-master"
-msgstr ""
-
-msgid "Search the duplicate files in the SOURCES directory."
-msgstr ""
-
-msgid "Optional: Search the duplicate files in the given directory paths."
-msgstr ""
-
-msgid "Optional: Override the default list of filtered files."
-msgstr ""
-
-msgid "Optional: Override the default list of filtered extensions."
-msgstr ""
-
-msgid "Optional: Override the default list of filtered paths."
-msgstr ""
-
-msgid "ERROR: Wrong init values for the progress bar\n"
-msgstr ""
-
-msgid "WARNING : wrong value for the progress bar.\n"
-msgstr ""
-
-msgid ""
-"The find_duplicates command search recursively for all duplicates files in a "
-"the INSTALL directory (or the optionally given directory) and prints the "
-"found files to the terminal.\n"
-"\n"
-"example:\n"
-"sat find_duplicates --path /tmp"
-msgstr ""
-
-#, python-format
-msgid "%s does not exists or is not a directory path: it will be ignored"
-msgstr ""
-
-msgid "Directories"
-msgstr ""
-
-msgid "Ignored files"
-msgstr ""
-
-msgid "Ignored extensions"
-msgstr ""
-
-msgid "Ignored directories"
-msgstr ""
-
-msgid "Store all file paths ... "
-msgstr ""
-
-msgid "Eliminate the files that are not duplicated"
-msgstr ""
-
-msgid ""
-"\n"
-"\n"
-"Compute the dict {files : [list of pathes]} ... "
-msgstr ""
-
-msgid "No duplicate files found.\n"
-msgstr ""
-
-#, python-format
-msgid "WARNING : element %s has not more than two paths.\n"
-msgstr ""
-
-msgid ""
-"\n"
-"Results:\n"
-"\n"
-msgstr ""
-
-msgid "Optional: the list of products to generate"
-msgstr ""
-
-msgid "Optional: path to YACSGEN's module_generator package"
-msgstr ""
-
-#, python-format
-msgid ""
-"product %(product)s is not defined. Include it in the application or define $"
-"%(env)s."
-msgstr ""
-
-msgid "Using YACSGEN from command line"
-msgstr ""
-
-msgid "Using YACSGEN from application"
-msgstr ""
-
-msgid "Using YACSGEN from environment"
-msgstr ""
-
-msgid "The generate command requires YACSGEN."
-msgstr ""
-
-#, python-format
-msgid "YACSGEN directory not found: '%s'"
-msgstr ""
-
-msgid "The python module module_generator was not found in YACSGEN"
-msgstr ""
-
-msgid ""
-"The generate command generates SALOME modules from 'pure cpp' products.\n"
-"WARNING this command NEEDS YACSGEN to run!\n"
-"\n"
-"example:\n"
-"sat generate SALOME-master --products FLICACPP"
-msgstr ""
-
-#, python-format
-msgid "Generation of SALOME modules for application %s\n"
-msgstr ""
-
-#, python-format
-msgid "Error: %s"
-msgstr ""
-
-msgid "YACSGEN dir"
-msgstr ""
-
-#, python-format
-msgid "Generating %s"
-msgstr ""
-
-msgid "Unknown product\n"
-msgstr ""
-
-msgid "not a generated product\n"
-msgstr ""
-
-#, python-format
-msgid "ERROR: %s"
-msgstr ""
-
-msgid "The following modules were not generated correctly:\n"
-msgstr ""
-
-msgid "Optional: The path to the products base"
-msgstr ""
-
-msgid ""
-"Optional: The path to the working directory (where to install the "
-"applications"
-msgstr ""
-
-msgid ""
-"Optional: The path to the local archive directory (where to install local "
-"source archives"
-msgstr ""
-
-msgid "Optional: The address of the repository of SAT (only informative)"
-msgstr ""
-
-msgid "Optional: The tag of SAT (only informative)"
-msgstr ""
-
-msgid "Optional: The directory where to put all the logs of SAT"
-msgstr ""
-
-#, python-format
-msgid "Unable to update the local.pyconf file: %s\n"
-msgstr ""
-
-msgid "Error: The given path is a file. Please provide a path to a directory"
-msgstr ""
-
-#, python-format
-msgid "Unable to create the directory '%(1)s': %(2)s\n"
-msgstr ""
-
-msgid "Changes the local settings of SAT."
-msgstr ""
-
-#, python-format
-msgid ""
-"Local Settings of SAT %s\n"
-"\n"
-msgstr ""
-
-msgid ""
-"Mandatory: The name of the config file that contains the jobs configuration"
-msgstr ""
-
-msgid "Mandatory: The job name from which to execute commands."
-msgstr ""
-
-msgid ""
-"Executes the commands of the job defined in the jobs configuration file\n"
-"\n"
-"example:\n"
-"sat job --jobs_config my_jobs --name my_job"
-msgstr ""
-
-msgid "The option --jobs_config is required\n"
-msgstr ""
-
-msgid "The option --name is required\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"The file configuration %(name_file)s was not found.\n"
-"Use the --list option to get the possible files."
-msgstr ""
-
-msgid "Platform"
-msgstr ""
-
-msgid "File containing the jobs configuration"
-msgstr ""
-
-#, python-format
-msgid "Impossible to find the job \"%(job_name)s\" in %(jobs_config_file)s"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Commands: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid ""
-"Mandatory: The name of the config file that contains the jobs configuration. "
-"Can be a list."
-msgstr ""
-
-msgid "Optional: the list of jobs to launch, by their name. "
-msgstr ""
-
-msgid "Optional: list all available config files."
-msgstr ""
-
-msgid "Optional: try to connect to the machines. Not executing the jobs."
-msgstr ""
-
-msgid ""
-"Optional: generate an xml file that can be read in a browser to display the "
-"jobs status."
-msgstr ""
-
-msgid "Optional: the path to csv file that contain the expected boards."
-msgstr ""
-
-msgid "Optional (internal use): do not print labels, Works only with --list."
-msgstr ""
-
-msgid "Authentication failed"
-msgstr ""
-
-msgid "The server's host key could not be verified"
-msgstr ""
-
-msgid "SSHException error connecting or establishing an SSH session"
-msgstr ""
-
-msgid "Error connecting or establishing an SSH session"
-msgstr ""
-
-#, python-format
-msgid ""
-"WARNING : trying to ask if the connection to \n"
-" (name: %(1)s host: %(2)s, port: %(3)s, user: %(4)s) is OK\n"
-" whereas there were no connection request"
-msgstr ""
-
-msgid ": the server failed to execute the command\n"
-msgstr ""
-
-#, python-format
-msgid "Unable to get remote log files: %s"
-msgstr ""
-
-msgid "Trying to get log files whereas the job is not finished."
-msgstr ""
-
-#, python-format
-msgid "Unable to get status from remote file '%(1)s': %(2)s"
-msgstr ""
-
-#, python-format
-msgid "Unable to get %(1)s log file from remote: %(2)s"
-msgstr ""
-
-msgid "This job was not launched because its father has failed."
-msgstr ""
-
-#, python-format
-msgid ""
-"Unable to get remote log files!\n"
-"%s\n"
-msgstr ""
-
-msgid "WARNING: A job can only be launched one time"
-msgstr ""
-
-#, python-format
-msgid "Trying to launch the job \"%s\" whereas it has already been launched."
-msgstr ""
-
-#, python-format
-msgid ""
-"WARNING: The job '%s' do not have the key 'machine'.\n"
-" This job is ignored.\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"WARNING: The job '%(job)s' requires the machine '%(machine)s'.\n"
-" This machine is not defined in the configuration file.\n"
-" The job will not be launched.\n"
-msgstr ""
-
-#, python-format
-msgid "Connection to %s: "
-msgstr ""
-
-msgid "Remove SAT"
-msgstr ""
-
-msgid "Copy SAT"
-msgstr ""
-
-#, python-format
-msgid "Copy of SAT failed: %s"
-msgstr ""
-
-msgid "Executing the jobs :\n"
-msgstr ""
-
-msgid "This job was not launched because its father is not in the jobs list."
-msgstr ""
-
-#, python-format
-msgid ""
-"WARNING: the file '%(1)s' can not be read, it will be ignored\n"
-"%(2)s"
-msgstr ""
-
-msgid ""
-"The jobs command launches maintenances that are described in the dedicated "
-"jobs configuration file.\n"
-"\n"
-"example:\n"
-"sat jobs --name my_jobs --publish"
-msgstr ""
-
-#, python-format
-msgid ""
-"The file configuration %s was not found.\n"
-"Use the --list option to get the possible files."
-msgstr ""
-
-msgid "Files containing the jobs configuration"
-msgstr ""
-
-msgid "Initialize the xml boards : "
-msgstr ""
-
-msgid "Forced interruption"
-msgstr ""
-
-msgid "CRITICAL ERROR: The jobs loop has been interrupted\n"
-msgstr ""
-
-msgid "Killing the running jobs and trying to get the corresponding logs\n"
-msgstr ""
-
-#, python-format
-msgid "Failed to kill job %(1)s: %(2)s\n"
-msgstr ""
-
-msgid ""
-"Optional: The name of the launcher (default is APPLICATION.profile."
-"launcher_name)"
-msgstr ""
-
-msgid ""
-"Optional: Create a resources catalog for the specified machines (separated "
-"with ',') \n"
-"\tNOTICE: this command will ssh to retrieve information to each machine in "
-"the list"
-msgstr ""
-
-#, python-format
-msgid "Generating launcher for %s :\n"
-msgstr ""
-
-msgid ""
-"The launcher command generates a SALOME launcher.\n"
-"\n"
-"example:\n"
-"sat launcher SALOME-master"
-msgstr ""
-
-msgid "Reading "
-msgstr ""
-
-msgid "Here are the command traces :\n"
-msgstr ""
-
-msgid "Which one (enter or 0 to quit)? "
-msgstr ""
-
-msgid ""
-"Gives access to the logs produced by the salomeTools commands.\n"
-"\n"
-"example:\n"
-"sat log"
-msgstr ""
-
-msgid "Generating the hat log file (can be long) ... "
-msgstr ""
-
-msgid ""
-"\n"
-"Opening the log file\n"
-msgstr ""
-
-msgid ""
-"Optional: products to install. This option can be passed several time to "
-"install several products."
-msgstr ""
-
-#, python-format
-msgid "Make install of %s"
-msgstr ""
-
-msgid ""
-"The makeinstall command executes the \"make install\" command in the build "
-"directory.\n"
-"In case of product that is constructed using a script (build_source : "
-"\"script\"), then the makeinstall command do nothing.\n"
-"\n"
-"example:\n"
-"sat makeinstall SALOME-master --products KERNEL,GUI"
-msgstr ""
-
-#, python-format
-msgid ""
-"Executing the make install command in the build directories of the "
-"application %s\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Make install: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid "Optional: Option to add to the make command."
-msgstr ""
-
-#, python-format
-msgid "Make of %s"
-msgstr ""
-
-msgid ""
-"The make command executes the \"make\" command in the build directory.\n"
-"example:\n"
-"sat make SALOME-master --products Python,KERNEL,GUI"
-msgstr ""
-
-#, python-format
-msgid ""
-"Executing the make command in the build directories of the application %s\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Make: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid "Optional: Produce a binary package."
-msgstr ""
-
-msgid ""
-"Optional: Only binary package: produce the archive even if there are some "
-"missing products."
-msgstr ""
-
-msgid ""
-"Optional: Produce a compilable archive of the sources of the application."
-msgstr ""
-
-msgid "Optional: Only source package: do not make archive of vcs products."
-msgstr ""
-
-msgid "Optional: Produce an archive that contains a project."
-msgstr ""
-
-msgid "Optional: Produce an archive that contains salomeTools."
-msgstr ""
-
-msgid "Optional: The name or full path of the archive."
-msgstr ""
-
-msgid "Optional: The list of additional files to add to the archive."
-msgstr ""
-
-msgid "Optional: do not add commercial licence."
-msgstr ""
-
-msgid ""
-"Optional: Filter the products by their properties.\n"
-"\tSyntax: --without_property <property>:<value>"
-msgstr ""
-
-msgid "OK"
-msgstr ""
-
-msgid "KO "
-msgstr ""
-
-msgid "ERROR: there are missing products installations:"
-msgstr ""
-
-msgid "WARNING: there are missing products installations:"
-msgstr ""
-
-msgid "ERROR: there are missing products sources:"
-msgstr ""
-
-msgid "WARNING: there are missing products sources:"
-msgstr ""
-
-msgid "clean sources\n"
-msgstr ""
-
-msgid "get sources"
-msgstr ""
-
-msgid ""
-"The package command creates an archive.\n"
-"There are 4 kinds of archive, which can be mixed:\n"
-" 1- The binary archive. It contains all the product installation "
-"directories and a launcher,\n"
-" 2- The sources archive. It contains the products archives, a project "
-"corresponding to the application and salomeTools,\n"
-" 3- The project archive. It contains a project (give the project file path "
-"as argument),\n"
-" 4- The salomeTools archive. It contains salomeTools.\n"
-"\n"
-"example:\n"
-"sat package SALOME-master --bineries --sources"
-msgstr ""
-
-msgid ""
-"Error: Precise a type for the package\n"
-"Use one of the following options: --binaries, --sources, --project or --"
-"salometools"
-msgstr ""
-
-#, python-format
-msgid "Packaging application %s\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"ERROR: the project %(proj)s is not visible by salomeTools.\n"
-"Please add it in the %(local)s file."
-msgstr ""
-
-msgid ""
-"Error: Cannot name the archive\n"
-" check if at least one of the following options was selected : --binaries, --"
-"sources, --project or --salometools"
-msgstr ""
-
-#, python-format
-msgid "The temporary working directory: %s\n"
-msgstr ""
-
-msgid "Preparation of files to add to the archive"
-msgstr ""
-
-msgid "Error: Empty dictionnary to build the archive!\n"
-msgstr ""
-
-#, python-format
-msgid "WARNING: the file %s is not accessible.\n"
-msgstr ""
-
-msgid "Actually do the package"
-msgstr ""
-
-msgid "Removing the temporary working directory ... "
-msgstr ""
-
-msgid "\n"
-msgstr ""
-
-msgid ""
-"Optional: products to get the sources. This option can be passed several "
-"time to get the sources of several products."
-msgstr ""
-
-#, python-format
-msgid "The %s product is native. Do not apply any patch."
-msgstr ""
-
-#, python-format
-msgid "No patch for the %s product"
-msgstr ""
-
-#, python-format
-msgid "No sources found for the %s product\n"
-msgstr ""
-
-#, fuzzy, python-format
-msgid "Not a valid patch: %s"
-msgstr " n'est pas une option valide"
-
-#, python-format
-msgid "Apply patch %s"
-msgstr ""
-
-#, python-format
-msgid "Failed to apply patch %s"
-msgstr ""
-
-msgid ""
-"The patch command apply the patches on the sources of the application "
-"products if there is any.\n"
-"\n"
-"example:\n"
-"sat patch SALOME-master --products qt,boost"
-msgstr ""
-
-msgid ""
-"Optional: products to prepare. This option can be passed several time to "
-"prepare several products."
-msgstr ""
-
-msgid "Optional: force to prepare the products in development mode."
-msgstr ""
-
-msgid "Optional: force to apply patch to the products in development mode."
-msgstr ""
-
-msgid ""
-"The prepare command gets the sources of the application products and apply "
-"the patches if there is any.\n"
-"\n"
-"example:\n"
-"sat prepare SALOME-master --products KERNEL,GUI"
-msgstr ""
-
-msgid ""
-"Do not get the source of the following products in development mode\n"
-"Use the --force option to overwrite it.\n"
-msgstr ""
-
-msgid ""
-"do not patch the following products in development mode\n"
-"Use the --force_patch option to overwrite it.\n"
-msgstr ""
-
-msgid "Clean the source directories ..."
-msgstr ""
-
-msgid "Get the sources of the products ..."
-msgstr ""
-
-msgid "Patch the product sources (if any) ..."
-msgstr ""
-
-msgid "Where the profile's sources will be generated."
-msgstr ""
-
-#, python-brace-format
-msgid ""
-"Name of the profile's sources. [Default: ${config.PRODUCT.name}_PROFILE]"
-msgstr ""
-
-msgid "Overwrites existing sources."
-msgstr ""
-
-msgid "Does not update pyconf file."
-msgstr ""
-
-msgid "Version of the application. [Default: 1.0]"
-msgstr ""
-
-msgid "Slogan of the application."
-msgstr ""
-
-msgid ""
-"The profile command creates default profile.\n"
-"usage: sat profile [PRODUCT] [-p|--prefix (string)] [-n|--name (string)] [-"
-"f|--force] [-v|--version (string)] [-s|--slogan (string)]"
-msgstr ""
-
-msgid "KERNEL's install has not the script app-quickstart.py"
-msgstr ""
-
-#, fuzzy
-msgid "GUI is not installed"
-msgstr "lsb_release n'est pas installé\n"
-
-#, python-format
-msgid "The path %s already exists, use option --force to remove it."
-msgstr ""
-
-#, python-format
-msgid "Profile sources were generated in directory %s.\n"
-msgstr ""
-
-#, python-format
-msgid "Updating %(new)s (previous version saved as %(old)s)."
-msgstr ""
-
-#, python-format
-msgid "The --%s argument is required\n"
-msgstr ""
-
-msgid ""
-"This command runs the application launcher with the given arguments.\n"
-"\n"
-"example:\n"
-"sat run SALOME-master"
-msgstr ""
-
-#, python-format
-msgid ""
-"The launcher %(1)s was not found in directory '%(2)s'.\n"
-"Did you run the command 'sat launcher' ?\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"The launcher at path '%s' is missing.\n"
-"Did you run the command 'sat launcher' ?\n"
-msgstr ""
-
-msgid "Executed command"
-msgstr ""
-
-msgid "Launching ...\n"
-msgstr ""
-
-msgid ""
-"\n"
-"End of execution. To see the traces, please tap the following command :\n"
-msgstr ""
-
-msgid ""
-"Optional: The number of processors to use in the script if the make command "
-"is used in it.\n"
-"\tWarning: the script has to be correctly written if you want this option to "
-"work.\n"
-"\tThe $MAKE_OPTIONS has to be used."
-msgstr ""
-
-#, python-format
-msgid "Running script of %s"
-msgstr ""
-
-msgid ""
-"The script command executes the script(s) of the the given products in the "
-"build directory.\n"
-"This is done only for the products that are constructed using a script "
-"(build_source : \"script\").\n"
-"Otherwise, nothing is done.\n"
-"\n"
-"example:\n"
-"sat script SALOME-master --products Python,numpy"
-msgstr ""
-
-#, python-format
-msgid "Executing the script in the build directories of the application %s\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"\n"
-"Script: %(status)s (%(valid_result)d/%(nb_products)d)\n"
-msgstr ""
-
-msgid "Mandatory: The shell command to execute."
-msgstr ""
-
-msgid ""
-"Executes the shell command passed as argument.\n"
-"\n"
-"example:\n"
-"sat shell --command \"ls \\-l /tmp\""
-msgstr ""
-
-msgid "The option --command is required\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"Command to execute:\n"
-"%s\n"
-"Execution ... "
-msgstr ""
-
-msgid ""
-"Optional: products from which to get the sources. This option can be passed "
-"several time to get the sources of several products."
-msgstr ""
-
-#, python-format
-msgid "Archive not found: '%s'"
-msgstr ""
-
-#, python-format
-msgid "Error: you must put a dir_info section in the file %s.pyconf"
-msgstr ""
-
-#, python-format
-msgid "Error: you must put a dir in the dir_info section in the file %s.pyconf"
-msgstr ""
-
-#, python-format
-msgid ""
-"Error: the dir '%(1)s' defined in the file\"\n"
-" %(2)s.pyconf does not exists"
-msgstr ""
-
-msgid "Set the application environment\n"
-msgstr ""
-
-msgid ""
-"INFORMATION : Not doing anything because the product is of type \"native\".\n"
-msgstr ""
-
-msgid ""
-"INFORMATION : Not doing anything because the product is of type \"fixed\".\n"
-msgstr ""
-
-#, python-format
-msgid "Unknown get source method \"%(get)s\" for product %(product)s"
-msgstr ""
-
-msgid ""
-"INFORMATION : Not doing anything because the source directory already "
-"exists.\n"
-msgstr ""
-
-#, python-format
-msgid "The required file %s does not exists. "
-msgstr ""
-
-msgid ""
-"\n"
-"Testing existence of file: \n"
-msgstr ""
-
-msgid ""
-"The source command gets the sources of the application products from cvs, "
-"git or an archive.\n"
-"\n"
-"example:\n"
-"sat source SALOME-master --products KERNEL,GUI"
-msgstr ""
-
-#, python-format
-msgid "Getting sources of the application %s\n"
-msgstr ""
-
-msgid "Getting sources of the application:"
-msgstr ""
-
-msgid "Following sources haven't been get:\n"
-msgstr ""
-
-msgid ""
-"REQUIRED: the name of the module to create.\n"
-"\tThe name must be a single word in upper case with only alphanumeric "
-"characters.\n"
-"\tWhen generating a c++ component the module's name must be suffixed with "
-"'CPP'."
-msgstr ""
-
-msgid "REQUIRED: the template to use."
-msgstr ""
-
-msgid "REQUIRED: where to create the module."
-msgstr ""
-
-msgid ""
-"Optional: dictionary to generate the configuration for salomeTools.\n"
-"\tFormat is: --param param1=value1,param2=value2... without spaces\n"
-"\tNote that when using this option you must supply all the values otherwise "
-"an error will be raised."
-msgstr ""
-
-msgid "Optional: Get information on the template."
-msgstr ""
-
-msgid "ERROR in template parameter definition"
-msgstr ""
-
-#, python-format
-msgid "value for '%s'"
-msgstr ""
-
-#, python-format
-msgid "Bad format in settings file! %s not defined."
-msgstr ""
-
-#, python-format
-msgid "Missing parameters: %s"
-msgstr ""
-
-#, python-format
-msgid "Template not found: %s"
-msgstr ""
-
-#, python-format
-msgid "Extract template %s\n"
-msgstr ""
-
-#, python-format
-msgid "Copy template %s\n"
-msgstr ""
-
-msgid "Settings file not found"
-msgstr ""
-
-msgid "Rename files\n"
-msgstr ""
-
-#, python-format
-msgid "Destination file already exists: %s"
-msgstr ""
-
-msgid "Rename directories\n"
-msgstr ""
-
-#, python-format
-msgid "Destination directory already exists: %s"
-msgstr ""
-
-msgid "Make substitution in files\n"
-msgstr ""
-
-msgid "Delimiter ="
-msgstr ""
-
-msgid "Ignore Filters ="
-msgstr ""
-
-msgid "Definition for sat not found in settings file."
-msgstr ""
-
-msgid "Create configuration file: "
-msgstr ""
-
-msgid "Run post command: "
-msgstr ""
-
-msgid "Template"
-msgstr ""
-
-msgid "No information for this template."
-msgstr ""
-
-msgid ""
-"The template command creates the sources for a SALOME module from a "
-"template.\n"
-"\n"
-"example\n"
-"sat template --name my_product_name --template PythonComponent --target /tmp"
-msgstr ""
-
-#, python-format
-msgid "Error: the --%s argument is required\n"
-msgstr ""
-
-msgid "Error: this command does not use a product."
-msgstr ""
-
-msgid ""
-"Error: component name must contains only alphanumeric characters and no "
-"spaces\n"
-msgstr ""
-
-#, python-format
-msgid "Error: the target already exists: %s"
-msgstr ""
-
-msgid "Create sources from template\n"
-msgstr ""
-
-msgid "Error: bad parameter definition"
-msgstr ""
-
-#, python-format
-msgid "The sources were created in %s"
-msgstr ""
-
-msgid ""
-"\n"
-"Do not forget to put them in your version control system."
-msgstr ""
-
-msgid ""
-"Optional: Indicate the name of the test base to use.\n"
-"\tThis name has to be registered in your application and in a project.\n"
-"\tA path to a test base can also be used."
-msgstr ""
-
-msgid ""
-"Optional: Use this option to specify the path to a SALOME launcher to use to "
-"launch the test scripts of the test base."
-msgstr ""
-
-msgid ""
-"Optional: Indicate which grid(s) to test (subdirectory of the test base)."
-msgstr ""
-
-msgid "Optional: indicate which session(s) to test (subdirectory of the grid)."
-msgstr ""
-
-msgid ""
-"Optional: set the display where to launch SALOME.\n"
-"\tIf value is NO then option --show-desktop=0 will be used to launch SALOME."
-msgstr ""
-
-msgid ""
-"The test command runs a test base on a SALOME installation.\n"
-"\n"
-"example:\n"
-"sat test SALOME-master --grid GEOM --session light"
-msgstr ""
-
-msgid "An application is required to use a relative path with option --appli"
-msgstr ""
-
-#, python-format
-msgid "Launcher not found: %s"
-msgstr ""
-
-#, python-format
-msgid "%s cannot be created."
-msgstr ""
+msgid "Usage: "
+msgstr "Utilisation : "
-#, python-format
-msgid "copy tests results to %s ... "
-msgstr ""
+msgid "Available commands are:\n"
+msgstr "Les commandes disponibles sont:\n"
-#, python-format
msgid ""
"\n"
-"check the display on %s\n"
-msgstr ""
-
-#, python-format
-msgid "Executing the command : %s "
-msgstr ""
-
-#, python-format
-msgid "Running tests on application %s\n"
-msgstr ""
-
-msgid "A test base is required. Use the --base option"
-msgstr ""
-
-msgid "WARNING: SALOME environment already sourced"
-msgstr ""
-
-msgid "Running SALOME application."
-msgstr ""
-
-msgid ""
-"Impossible to find any launcher.\n"
-"Please specify an application or a launcher"
-msgstr ""
-
-#, python-format
-msgid "error removing TT_TMP_RESULT %s\n"
-msgstr ""
-
-msgid "Display"
-msgstr ""
-
-msgid "Timeout"
-msgstr ""
-
-msgid "Working dir"
-msgstr ""
-
-msgid "Tests finished"
+"Getting the help for a specific command: "
msgstr ""
-
-msgid ""
"\n"
-"Generate the specific test log\n"
-msgstr ""
-
-#, python-format
-msgid "Removing the temporary directory: rm -rf %s\n"
-msgstr ""
+"Obtenir l'aide d'une commande spécifique : "
msgid "lsb_release not installed\n"
msgstr "lsb_release n'est pas installé\n"
"SVP ajoutez votre distribution au fichier src/internal_config/distrib."
"pyconf\n"
-#, python-format
-msgid "Compile %(product)s using script %(script)s\n"
-msgstr ""
-
-#, python-format
-msgid "Run build script %s\n"
-msgstr ""
-
-#, python-format
-msgid "The script %s must have .sh, .bat or .py extension."
-msgstr ""
-
-#, python-format
-msgid "Missing definition in environment: %s"
-msgstr ""
-
-#, python-format
-msgid "No install_dir for product %s\n"
-msgstr ""
-
-#, python-format
-msgid "Setting environment for %s\n"
-msgstr ""
-
-#, python-format
-msgid "Environment script not found: %s"
-msgstr ""
-
-#, python-format
-msgid "Create environment file %s\n"
-msgstr ""
-
-#, python-format
-msgid "Create configuration file %s\n"
-msgstr ""
-
-msgid ""
-"An APPLICATION is required. Use 'config --list' to get the list of available "
-"applications.\n"
-msgstr ""
-
-msgid "A profile section is required in your application.\n"
-msgstr ""
-
-#, python-format
-msgid "Please define a base path in the file %s"
-msgstr ""
-
-#, python-format
-msgid "Please define a log_dir in the file %s"
-msgstr ""
-
-#, python-format
-msgid ""
-"Error in configuration file: %(file)s\n"
-" %(error)s"
-msgstr ""
-
-msgid "ERROR:"
-msgstr ""
-
-#, python-format
-msgid "WARNING: the log file %s cannot be read:"
-msgstr ""
-
msgid " is not a valid option"
msgstr " n'est pas une option valide"
msgid "Available options are:"
msgstr "Les options disponibles sont:"
-#, python-format
-msgid ""
-"The product %(prod)s has version %(ver)s but is declared as native in its "
-"definition"
-msgstr ""
-
-#, python-format
-msgid ""
-"No definition found for the product %(1)s.\n"
-"Please create a %(2)s.pyconf file."
-msgstr ""
-
-#, python-format
-msgid ""
-"No definition corresponding to the version %(1)s\n"
-"was found in the file %(2)s.\n"
-"Please add a section in it."
-msgstr ""
-
-#, python-format
-msgid "Archive %(1)s for %(2)s not found.\n"
-msgstr ""
-
-#, python-format
-msgid "Archive %(1)s for %(2)s not found:\n"
-msgstr ""
-
-#, python-format
-msgid ""
-"No compilation script found for the product %s.\n"
-"Please provide a 'compil_script' key in its definition."
-msgstr ""
-
-#, python-format
-msgid "Compilation script not found: %s"
-msgstr ""
-
-#, python-format
-msgid "Patch %(1)s for %(2)s not found:\n"
-msgstr ""
-
-#, python-format
-msgid "Environment script %(1)s for %(2)s not found.\n"
-msgstr ""
-
-#, python-format
-msgid "The %s product has no definition in the configuration."
-msgstr ""
-
-#, python-format
-msgid "Unable to edit file %s\n"
-msgstr ""
-
-#, python-format
-msgid "get test base from dir: %s\n"
-msgstr ""
-
-#, python-format
-msgid "testbase %(name)s (%(dir)s) does not exist ...\n"
-msgstr ""
-
-#, python-format
-msgid "get test base '%(testbase)s' with '%(tag)s' tag from git\n"
-msgstr ""
-
-#, python-format
-msgid "Error: unable to get test base '%(name)s' from git '%(repo)s'."
-msgstr ""
-
-msgid "git is not installed. exiting...\n"
-msgstr ""
-
-#, python-format
-msgid "get test base '%s' from svn\n"
-msgstr ""
-
-#, python-format
-msgid "Error: unable to get test base '%(name)s' from svn '%(repo)s'."
-msgstr ""
-
-msgid "svn is not installed. exiting...\n"
-msgstr ""
-
-msgid "Test base"
-msgstr ""
-
-#, python-format
-msgid "ERROR: test base '%s' not found\n"
-msgstr ""
-
-#, python-format
-msgid "unknown source type '%(type)s' for test base '%(base)s' ...\n"
-msgstr ""
-
-msgid "Load test settings\n"
-msgstr ""
-
-msgid "=== STARTING TESTS"
-msgstr ""
-
-msgid "=== END TESTS"
-msgstr ""
-
-#, python-format
-msgid "Tests Results: %(succeed)d / %(total)d\n"
-msgstr ""
-
-#, python-format
-msgid "%d tests TIMEOUT\n"
-msgstr ""
-
-#, python-format
-msgid "%d tests not executed\n"
-msgstr ""
-
-#, python-format
-msgid "Status: %s\n"
-msgstr ""
try:
self.logTxtFile = open(str(self.txtFilePath), 'w')
except IOError:
- #msg1 = _("WARNING! Trying to write to a file that"
- # " is not accessible:")
+ #msg1 = _("WARNING! Trying to write to a file that is not accessible:")
#msg2 = _("The logs won't be written.")
#print("%s\n%s\n%s\n" % (src.printcolors.printcWarning(msg1),
# src.printcolors.printcLabel(str(self.txtFilePath)),
try:
logFileXml = src.xmlManager.ReadXmlFile(logFilePath)
except Exception as e:
- msg = _("WARNING: the log file %s cannot be read:" % logFilePath)
+ msg = _("WARNING: the log file %s cannot be read:") % logFilePath
sys.stdout.write(printcolors.printcWarning("%s\n%s\n" % (msg, e)))
return False, None, None
'''
import getopt
import sys
+import pprint as PP
+
from . import printcolors
class OptResult(object):
:return: Nothing.
:rtype: N\A
'''
- object.__setattr__(self,name,value)
+ object.__setattr__(self, name, value)
+
+ def __repr__(self):
+ res = "%s(%s)" % (self.__class__.__name__, PP.pformat(self.__dict__))
+ return res
class Options:
'''Class to manage all salomeTools options
prod_info.get_source = "native"
elif prod_info.get_source == "native":
msg = _("The product %(prod)s has version %(ver)s but is "
- "declared as native in its definition") %
- {'prod': prod_info.name, 'ver': version}
+ "declared as native in its definition") % \
+ {'prod': prod_info.name, 'ver': version}
raise src.SatException(msg)
# If there is no definition but the product is declared as native,
Please create a %(2)s.pyconf file.""") % {"1": product_name, "2": product_name}
else:
msg = _("""\
-No definition corresponding to the version %(1)s
-was found in the file %(2)s.
+No definition corresponding to the version %(1)s was found in the file:
+ %(2)s.
Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path}
raise src.SatException(msg)
arch_path = src.find_file_in_lpath(arch_name,
config.PATHS.ARCHIVEPATH)
if not arch_path:
- msg = _("Archive %(1)s for %(2)s not found.\n") %
+ msg = _("Archive %(1)s for %(2)s not found.\n") % \
{"1" : arch_name, "2" : prod_info.name}
raise src.SatException(msg)
prod_info.archive_info.archive_name = arch_path
arch_name,
config.PATHS.ARCHIVEPATH)
if not arch_path:
- msg = _("Archive %(1)s for %(2)s not found:\n") %
+ msg = _("Archive %(1)s for %(2)s not found:\n") % \
{"1" : arch_name, "2" : prod_info.name}
raise src.SatException(msg)
prod_info.archive_info.archive_name = arch_path
config.PATHS.PRODUCTPATH,
"compil_scripts")
if not script_path:
- raise src.SatException(_("Compilation script not found: %s") %
- script_name)
+ raise src.SatException(
+ _("Compilation script not found: %s") % script_name)
prod_info.compil_script = script_path
if src.architecture.is_windows():
prod_info.compil_script = prod_info.compil_script[:-len(".sh")] + ".bat"
#raise src.SatException(
# _("Compilation script cannot be executed: %s") %
# prod_info.compil_script)
- print("Compilation script cannot be executed: %s" %
- prod_info.compil_script)
+ print("Compilation script cannot be executed: %s" % prod_info.compil_script)
# Get the full paths of all the patches
if product_has_patches(prod_info):
config.PATHS.PRODUCTPATH,
"patches")
if not patch_path:
- msg = _("Patch %(1)s for %(2)s not found:\n") %
+ msg = _("Patch %(1)s for %(2)s not found:\n") % \
{"1" : patch, "2" : prod_info.name}
raise src.SatException(msg)
patches.append(patch_path)
config.PATHS.PRODUCTPATH,
"env_scripts")
if not env_script_path:
- msg = _("Environment script %(1)s for %(2)s not found.\n") %
+ msg = _("Environment script %(1)s for %(2)s not found.\n") % \
{"1" : env_script_path, "2" : prod_info.name}
raise src.SatException(msg)
p = subprocess.Popen(cmd, shell=True)
p.communicate()
except:
- logger.write(printcolors.printcError(_("Unable to edit file %s\n")
- % filePath), 1)
+ logger.write(printcolors.printcError(
+ _("Unable to edit file %s\n") % filePath), 1)
def git_extract(from_what, tag, where, logger, environment=None):
shell=True,
stdout=logger.logTxtFile,
stderr=subprocess.STDOUT)
- return (res == 0)
\ No newline at end of file
+ return (res == 0)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2013 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
import imp
import subprocess
-from . import fork
import src
# directories not considered as test grids
symlinks=True)
def prepare_testbase_from_dir(self, testbase_name, testbase_dir):
- self.logger.write(_("get test base from dir: %s\n") %
+ self.logger.write(_("get test base from dir: %s\n") % \
src.printcolors.printcLabel(testbase_dir), 3)
if not os.access(testbase_dir, os.X_OK):
raise src.SatException(
- _("testbase %(name)s (%(dir)s) does not exist ...\n") %
+ _("testbase %(name)s (%(dir)s) does not exist ...\n") % \
{ 'name': testbase_name, 'dir': testbase_dir } )
self._copy_dir(testbase_dir,
testbase_base,
testbase_tag):
self.logger.write(
- _("get test base '%(testbase)s' with '%(tag)s' tag from git\n") %
+ _("get test base '%(testbase)s' with '%(tag)s' tag from git\n") % \
{ "testbase" : src.printcolors.printcLabel(testbase_name),
"tag" : src.printcolors.printcLabel(testbase_tag) },
3)
if res != 0:
raise src.SatException(
- _("Error: unable to get test base '%(name)s' from svn '%(repo)s'.") %
+ _("ERROR: unable to get test base '%(name)s' from svn '%(repo)s'.") % \
{ 'name': testbase_name, 'repo': testbase_base } )
except OSError:
return 0
if not test_base_info:
- message = (_("ERROR: test base '%s' not found\n") % test_base_name)
+ message = _("ERROR: test base '%s' not found\n") % test_base_name
self.logger.write("%s\n" % src.printcolors.printcError(message))
return 1
test_base_info.info.base)
else:
raise src.SatException(
- _("unknown source type '%(type)s' for test base '%(base)s' ...\n") %
+ _("unknown source type '%(type)s' for test base '%(base)s' ...\n") % \
{'type': test_base_info.get_sources, 'base': test_base_name } )
self.currentTestBase = test_base_name
executable='/bin/bash').communicate()
print "TRACES OP - test_module.py/Test.get_tmp_dir() subproc_res = "
for resLine in subproc_res:
- print "- '#%s#'" %resLine
+ print "- '#%s#'" % resLine
root_dir = subproc_res[0].split()[-1]
# OP 14/11/2017 Ajout de traces pour essayer de decouvrir le pb
# de remontee de log des tests
- print "TRACES OP - test_module.py/Test.get_tmp_dir() root_dir = '#%s#'" %root_dir
+ print "TRACES OP - test_module.py/Test.get_tmp_dir() root_dir = '#%s#'" % root_dir
# import grid salome_utils from KERNEL that gives
# the right getTmpDir function
elapsed = -1
if self.currentsession.startswith("NOGUI_"):
# runSalome -t (bash)
- status, elapsed = fork.batch(binSalome, self.logger,
- os.path.join(self.tmp_working_dir,
- "WORK"),
- [ "-t",
- "--shutdown-server=1",
- script_path ],
- delai=time_out,
- log=logWay)
+ status, elapsed = src.fork.batch(
+ binSalome, self.logger,
+ os.path.join(self.tmp_working_dir, "WORK"),
+ [ "-t", "--shutdown-server=1", script_path ],
+ delai=time_out, log=logWay )
elif self.currentsession.startswith("PY_"):
# python script.py
- status, elapsed = fork.batch(binPython, self.logger,
- os.path.join(self.tmp_working_dir,
- "WORK"),
- [script_path],
- delai=time_out, log=logWay)
+ status, elapsed = src.fork.batch(
+ binPython, self.logger,
+ os.path.join(self.tmp_working_dir, "WORK"),
+ [script_path],
+ delai=time_out, log=logWay)
else:
opt = "-z 0"
if self.show_desktop: opt = "--show-desktop=0"
- status, elapsed = fork.batch_salome(binSalome,
- self.logger,
- os.path.join(
- self.tmp_working_dir,
- "WORK"),
- [ opt,
- "--shutdown-server=1",
- script_path ],
- getTmpDir=tmpDir,
- fin=killSalome,
- delai=time_out,
- log=logWay,
- delaiapp=time_out_salome)
-
- self.logger.write("status = %s, elapsed = %s\n" % (status, elapsed),
- 5)
+ status, elapsed = src.fork.batch_salome(
+ binSalome, self.logger,
+ os.path.join(self.tmp_working_dir, "WORK"),
+ [ opt, "--shutdown-server=1", script_path ],
+ getTmpDir=tmpDir,
+ fin=killSalome,
+ delai=time_out,
+ log=logWay,
+ delaiapp=time_out_salome)
+
+ self.logger.write("status = %s, elapsed = %s\n" % (status, elapsed), 5)
# create the test result to add in the config object
test_info = src.pyconf.Mapping(self.config)
def run_session_tests(self):
self.logger.write(self.write_test_margin(2), 3)
- self.logger.write("Session = %s\n" % src.printcolors.printcLabel(
- self.currentsession), 3, False)
+ self.logger.write("Session = %s\n" % \
+ src.printcolors.printcLabel(self.currentsession), 3, False)
# prepare list of tests to run
tests = os.listdir(os.path.join(self.currentDir,
# Runs all tests of a grid.
def run_grid_tests(self):
self.logger.write(self.write_test_margin(1), 3)
- self.logger.write("grid = %s\n" % src.printcolors.printcLabel(
- self.currentgrid), 3, False)
+ self.logger.write("grid = %s\n" % \
+ src.printcolors.printcLabel(self.currentgrid), 3, False)
grid_path = os.path.join(self.currentDir, self.currentgrid)
for session_ in sessions:
if not os.path.exists(os.path.join(grid_path, session_)):
self.logger.write(self.write_test_margin(2), 3)
- self.logger.write(src.printcolors.printcWarning("Session %s not"
- " found" % session_) + "\n", 3, False)
+ self.logger.write(
+ src.printcolors.printcWarning("Session %s not found" % session_) + "\n", 3, False)
else:
self.currentsession = session_
self.run_session_tests()
self.logger.write("\n", 4, False)
self.logger.write(self.write_test_margin(0), 3)
- testbase_label = "Test base = %s\n" % src.printcolors.printcLabel(
- self.currentTestBase)
+ testbase_label = "Test base = %s\n" % \
+ src.printcolors.printcLabel(self.currentTestBase)
self.logger.write(testbase_label, 3, False)
- self.logger.write("-" * len(src.printcolors.cleancolor(testbase_label)),
- 3)
+ self.logger.write("-" * len(src.printcolors.cleancolor(testbase_label)), 3)
self.logger.write("\n", 3, False)
# load settings
self.logger.write("\n", 2, False)
if not os.path.exists(script):
- self.logger.write(src.printcolors.printcWarning("WARNING: scrip"
- "t not found: %s" % script) + "\n", 2)
+ self.logger.write(src.printcolors.printcWarning(
+ "WARNING: script not found: %s" % script) + "\n", 2)
else:
- self.logger.write(src.printcolors.printcHeader("----------- sta"
- "rt %s" % script_name) + "\n", 2)
+ self.logger.write(src.printcolors.printcHeader(
+ "----------- start %s" % script_name) + "\n", 2)
self.logger.write("Run script: %s\n" % script, 2)
subprocess.Popen(script, shell=True).wait()
- self.logger.write(src.printcolors.printcHeader("----------- end"
- " %s" % script_name) + "\n", 2)
+ self.logger.write(src.printcolors.printcHeader(
+ "----------- end %s" % script_name) + "\n", 2)
def run_all_tests(self):
initTime = datetime.datetime.now()
self.logger.write("\n", 2, False)
# evaluate results
- res_count = "%d / %d" % (self.nb_succeed,
- self.nb_run - self.nb_acknoledge)
+ res_count = "%d / %d" % \
+ (self.nb_succeed, self.nb_run - self.nb_acknoledge)
- res_out = _("Tests Results: %(succeed)d / %(total)d\n") %
- { 'succeed': self.nb_succeed, 'total': self.nb_run }
+ res_out = _("Tests Results: %(1)d/%(2)d\n") % \
+ { '1': self.nb_succeed, '2': self.nb_run }
if self.nb_succeed == self.nb_run:
res_out = src.printcolors.printcSuccess(res_out)
else:
elif self.nb_acknoledge:
status = src.KNOWNFAILURE_STATUS
- self.logger.write(_("Status: %s\n" % status), 3)
+ self.logger.write(_("Status: %s\n") % status, 3)
return self.nb_run - self.nb_succeed - self.nb_acknoledge
+++ /dev/null
-"""
-A TestRunner for use with the Python unit testing framework. It
-generates a HTML report to show the result at a glance.
-
-The simplest way to use this is to invoke its main method. E.g.
-
- import unittest
- import HTMLTestRunner
-
- ... define your tests ...
-
- if __name__ == '__main__':
- HTMLTestRunner.main()
-
-
-For more customization options, instantiates a HTMLTestRunner object.
-HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g.
-
- # output to a file
- fp = file('my_report.html', 'wb')
- runner = HTMLTestRunner.HTMLTestRunner(
- stream=fp,
- title='My unit test',
- description='This demonstrates the report output by HTMLTestRunner.'
- )
-
- # Use an external stylesheet.
- # See the Template_mixin class for more customizable options
- runner.STYLESHEET_TMPL = '<link rel="stylesheet" href="my_stylesheet.css" type="text/css">'
-
- # run the test
- runner.run(my_test_suite)
-
-
-------------------------------------------------------------------------
-Copyright (c) 2004-2007, Wai Yip Tung
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-* Neither the name Wai Yip Tung nor the names of its contributors may be
- used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"""
-
-# URL: http://tungwaiyip.info/software/HTMLTestRunner.html
-
-__author__ = "Wai Yip Tung"
-__version__ = "0.8.2"
-
-
-"""
-Change History
-
-Version 0.8.2
-* Show output inline instead of popup window (Viorel Lupu).
-
-Version in 0.8.1
-* Validated XHTML (Wolfgang Borgert).
-* Added description of test classes and test cases.
-
-Version in 0.8.0
-* Define Template_mixin class for customization.
-* Workaround a IE 6 bug that it does not treat <script> block as CDATA.
-
-Version in 0.7.1
-* Back port to Python 2.3 (Frank Horowitz).
-* Fix missing scroll bars in detail log (Podi).
-"""
-
-# TODO: color stderr
-# TODO: simplify javascript using ,ore than 1 class in the class attribute?
-
-import datetime
-import StringIO
-import sys
-import time
-import unittest
-from xml.sax import saxutils
-
-
-# ------------------------------------------------------------------------
-# The redirectors below are used to capture output during testing. Output
-# sent to sys.stdout and sys.stderr are automatically captured. However
-# in some cases sys.stdout is already cached before HTMLTestRunner is
-# invoked (e.g. calling logging.basicConfig). In order to capture those
-# output, use the redirectors for the cached stream.
-#
-# e.g.
-# >>> logging.basicConfig(stream=HTMLTestRunner.stdout_redirector)
-# >>>
-
-class OutputRedirector(object):
- """ Wrapper to redirect stdout or stderr """
- def __init__(self, fp):
- self.fp = fp
-
- def write(self, s):
- self.fp.write(s)
-
- def writelines(self, lines):
- self.fp.writelines(lines)
-
- def flush(self):
- self.fp.flush()
-
-stdout_redirector = OutputRedirector(sys.stdout)
-stderr_redirector = OutputRedirector(sys.stderr)
-
-
-
-# ----------------------------------------------------------------------
-# Template
-
-class Template_mixin(object):
- """
- Define a HTML template for report customerization and generation.
-
- Overall structure of an HTML report
-
- HTML
- +------------------------+
- |<html> |
- | <head> |
- | |
- | STYLESHEET |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | </head> |
- | |
- | <body> |
- | |
- | HEADING |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | REPORT |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | ENDING |
- | +----------------+ |
- | | | |
- | +----------------+ |
- | |
- | </body> |
- |</html> |
- +------------------------+
- """
-
- STATUS = {
- 0: 'pass',
- 1: 'fail',
- 2: 'error',
- }
-
- DEFAULT_TITLE = 'Unit Test Report'
- DEFAULT_DESCRIPTION = ''
-
- # ------------------------------------------------------------------------
- # HTML Template
-
- HTML_TMPL = r"""<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>%(title)s</title>
- <meta name="generator" content="%(generator)s"/>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- %(stylesheet)s
-</head>
-<body>
-<script language="javascript" type="text/javascript"><!--
-output_list = Array();
-
-/* level - 0:Summary; 1:Failed; 2:All */
-function showCase(level) {
- trs = document.getElementsByTagName("tr");
- for (var i = 0; i < trs.length; i++) {
- tr = trs[i];
- id = tr.id;
- if (id.substr(0,2) == 'ft') {
- if (level < 1) {
- tr.className = 'hiddenRow';
- }
- else {
- tr.className = '';
- }
- }
- if (id.substr(0,2) == 'pt') {
- if (level > 1) {
- tr.className = '';
- }
- else {
- tr.className = 'hiddenRow';
- }
- }
- }
-}
-
-
-function showClassDetail(cid, count) {
- var id_list = Array(count);
- var toHide = 1;
- for (var i = 0; i < count; i++) {
- tid0 = 't' + cid.substr(1) + '.' + (i+1);
- tid = 'f' + tid0;
- tr = document.getElementById(tid);
- if (!tr) {
- tid = 'p' + tid0;
- tr = document.getElementById(tid);
- }
- id_list[i] = tid;
- if (tr.className) {
- toHide = 0;
- }
- }
- for (var i = 0; i < count; i++) {
- tid = id_list[i];
- if (toHide) {
- document.getElementById('div_'+tid).style.display = 'none'
- document.getElementById(tid).className = 'hiddenRow';
- }
- else {
- document.getElementById(tid).className = '';
- }
- }
-}
-
-
-function showTestDetail(div_id){
- var details_div = document.getElementById(div_id)
- var displayState = details_div.style.display
- // alert(displayState)
- if (displayState != 'block' ) {
- displayState = 'block'
- details_div.style.display = 'block'
- }
- else {
- details_div.style.display = 'none'
- }
-}
-
-
-function html_escape(s) {
- s = s.replace(/&/g,'&');
- s = s.replace(/</g,'<');
- s = s.replace(/>/g,'>');
- return s;
-}
-
-/* obsoleted by detail in <div>
-function showOutput(id, name) {
- var w = window.open("", //url
- name,
- "resizable,scrollbars,status,width=800,height=450");
- d = w.document;
- d.write("<pre>");
- d.write(html_escape(output_list[id]));
- d.write("\n");
- d.write("<a href='javascript:window.close()'>close</a>\n");
- d.write("</pre>\n");
- d.close();
-}
-*/
---></script>
-
-%(heading)s
-%(report)s
-%(ending)s
-
-</body>
-</html>
-"""
- # variables: (title, generator, stylesheet, heading, report, ending)
-
-
- # ------------------------------------------------------------------------
- # Stylesheet
- #
- # alternatively use a <link> for external style sheet, e.g.
- # <link rel="stylesheet" href="$url" type="text/css">
-
- STYLESHEET_TMPL = """
-<style type="text/css" media="screen">
-body { font-family: verdana, arial, helvetica, sans-serif; font-size: 80%; }
-table { font-size: 100%; }
-pre { }
-
-/* -- heading ---------------------------------------------------------------------- */
-h1 {
- font-size: 16pt;
- color: gray;
-}
-.heading {
- margin-top: 0ex;
- margin-bottom: 1ex;
-}
-
-.heading .attribute {
- margin-top: 1ex;
- margin-bottom: 0;
-}
-
-.heading .description {
- margin-top: 4ex;
- margin-bottom: 6ex;
-}
-
-/* -- css div popup ------------------------------------------------------------------------ */
-a.popup_link {
-}
-
-a.popup_link:hover {
- color: red;
-}
-
-.popup_window {
- display: none;
- position: relative;
- left: 0px;
- top: 0px;
- /*border: solid #627173 1px; */
- padding: 10px;
- background-color: #E6E6D6;
- font-family: "Lucida Console", "Courier New", Courier, monospace;
- text-align: left;
- font-size: 8pt;
- width: 500px;
-}
-
-}
-/* -- report ------------------------------------------------------------------------ */
-#show_detail_line {
- margin-top: 3ex;
- margin-bottom: 1ex;
-}
-#result_table {
- width: 80%;
- border-collapse: collapse;
- border: 1px solid #777;
-}
-#header_row {
- font-weight: bold;
- color: white;
- background-color: #777;
-}
-#result_table td {
- border: 1px solid #777;
- padding: 2px;
-}
-#total_row { font-weight: bold; }
-.passClass { background-color: #6c6; }
-.failClass { background-color: #c60; }
-.errorClass { background-color: #c00; }
-.passCase { color: #6c6; }
-.failCase { color: #c60; font-weight: bold; }
-.errorCase { color: #c00; font-weight: bold; }
-.hiddenRow { display: none; }
-.testcase { margin-left: 2em; }
-
-
-/* -- ending ---------------------------------------------------------------------- */
-#ending {
-}
-
-</style>
-"""
-
-
-
- # ------------------------------------------------------------------------
- # Heading
- #
-
- HEADING_TMPL = """<div class='heading'>
-<h1>%(title)s</h1>
-%(parameters)s
-<p class='description'>%(description)s</p>
-</div>
-
-""" # variables: (title, parameters, description)
-
- HEADING_ATTRIBUTE_TMPL = """<p class='attribute'><strong>%(name)s:</strong> %(value)s</p>
-""" # variables: (name, value)
-
-
-
- # ------------------------------------------------------------------------
- # Report
- #
-
- REPORT_TMPL = """
-<p id='show_detail_line'>Show
-<a href='javascript:showCase(0)'>Summary</a>
-<a href='javascript:showCase(1)'>Failed</a>
-<a href='javascript:showCase(2)'>All</a>
-</p>
-<table id='result_table'>
-<colgroup>
-<col align='left' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-<col align='right' />
-</colgroup>
-<tr id='header_row'>
- <td>Test Group/Test case</td>
- <td>Count</td>
- <td>Pass</td>
- <td>Fail</td>
- <td>Error</td>
- <td>View</td>
-</tr>
-%(test_list)s
-<tr id='total_row'>
- <td>Total</td>
- <td>%(count)s</td>
- <td>%(Pass)s</td>
- <td>%(fail)s</td>
- <td>%(error)s</td>
- <td> </td>
-</tr>
-</table>
-""" # variables: (test_list, count, Pass, fail, error)
-
- REPORT_CLASS_TMPL = r"""
-<tr class='%(style)s'>
- <td>%(desc)s</td>
- <td>%(count)s</td>
- <td>%(Pass)s</td>
- <td>%(fail)s</td>
- <td>%(error)s</td>
- <td><a href="javascript:showClassDetail('%(cid)s',%(count)s)">Detail</a></td>
-</tr>
-""" # variables: (style, desc, count, Pass, fail, error, cid)
-
-
- REPORT_TEST_WITH_OUTPUT_TMPL = r"""
-<tr id='%(tid)s' class='%(Class)s'>
- <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
- <td colspan='5' align='center'>
-
- <!--css div popup start-->
- <a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_%(tid)s')" >
- %(status)s</a>
-
- <div id='div_%(tid)s' class="popup_window">
- <div style='text-align: right; color:red;cursor:pointer'>
- <a onfocus='this.blur();' onclick="document.getElementById('div_%(tid)s').style.display = 'none' " >
- [x]</a>
- </div>
- <pre>
- %(script)s
- </pre>
- </div>
- <!--css div popup end-->
-
- </td>
-</tr>
-""" # variables: (tid, Class, style, desc, status)
-
-
- REPORT_TEST_NO_OUTPUT_TMPL = r"""
-<tr id='%(tid)s' class='%(Class)s'>
- <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
- <td colspan='5' align='center'>%(status)s</td>
-</tr>
-""" # variables: (tid, Class, style, desc, status)
-
-
- REPORT_TEST_OUTPUT_TMPL = r"""
-%(id)s: %(output)s
-""" # variables: (id, output)
-
-
-
- # ------------------------------------------------------------------------
- # ENDING
- #
-
- ENDING_TMPL = """<div id='ending'> </div>"""
-
-# -------------------- The end of the Template class -------------------
-
-
-TestResult = unittest.TestResult
-
-class _TestResult(TestResult):
- # note: _TestResult is a pure representation of results.
- # It lacks the output and reporting ability compares to unittest._TextTestResult.
-
- def __init__(self, verbosity=1):
- TestResult.__init__(self)
- self.stdout0 = None
- self.stderr0 = None
- self.success_count = 0
- self.failure_count = 0
- self.error_count = 0
- self.verbosity = verbosity
-
- # result is a list of result in 4 tuple
- # (
- # result code (0: success; 1: fail; 2: error),
- # TestCase object,
- # Test output (byte string),
- # stack trace,
- # )
- self.result = []
-
-
- def startTest(self, test):
- TestResult.startTest(self, test)
- # just one buffer for both stdout and stderr
- self.outputBuffer = StringIO.StringIO()
- stdout_redirector.fp = self.outputBuffer
- stderr_redirector.fp = self.outputBuffer
- self.stdout0 = sys.stdout
- self.stderr0 = sys.stderr
- sys.stdout = stdout_redirector
- sys.stderr = stderr_redirector
-
-
- def complete_output(self):
- """
- Disconnect output redirection and return buffer.
- Safe to call multiple times.
- """
- if self.stdout0:
- sys.stdout = self.stdout0
- sys.stderr = self.stderr0
- self.stdout0 = None
- self.stderr0 = None
- return self.outputBuffer.getvalue()
-
-
- def stopTest(self, test):
- # Usually one of addSuccess, addError or addFailure would have been called.
- # But there are some path in unittest that would bypass this.
- # We must disconnect stdout in stopTest(), which is guaranteed to be called.
- self.complete_output()
-
-
- def addSuccess(self, test):
- self.success_count += 1
- TestResult.addSuccess(self, test)
- output = self.complete_output()
- self.result.append((0, test, output, ''))
- if self.verbosity > 1:
- sys.stderr.write('ok ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('.')
-
- def addError(self, test, err):
- self.error_count += 1
- TestResult.addError(self, test, err)
- _, _exc_str = self.errors[-1]
- output = self.complete_output()
- self.result.append((2, test, output, _exc_str))
- if self.verbosity > 1:
- sys.stderr.write('E ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('E')
-
- def addFailure(self, test, err):
- self.failure_count += 1
- TestResult.addFailure(self, test, err)
- _, _exc_str = self.failures[-1]
- output = self.complete_output()
- self.result.append((1, test, output, _exc_str))
- if self.verbosity > 1:
- sys.stderr.write('F ')
- sys.stderr.write(str(test))
- sys.stderr.write('\n')
- else:
- sys.stderr.write('F')
-
-
-class HTMLTestRunner(Template_mixin):
- """
- """
- def __init__(self, stream=sys.stdout, verbosity=1, title=None, description=None):
- self.stream = stream
- self.verbosity = verbosity
- if title is None:
- self.title = self.DEFAULT_TITLE
- else:
- self.title = title
- if description is None:
- self.description = self.DEFAULT_DESCRIPTION
- else:
- self.description = description
-
- self.startTime = datetime.datetime.now()
-
-
- def run(self, test):
- "Run the given test case or test suite."
- result = _TestResult(self.verbosity)
- test(result)
- self.stopTime = datetime.datetime.now()
- self.generateReport(test, result)
- print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)
- return result
-
-
- def sortResult(self, result_list):
- # unittest does not seems to run in any particular order.
- # Here at least we want to group them together by class.
- rmap = {}
- classes = []
- for n,t,o,e in result_list:
- cls = t.__class__
- if not rmap.has_key(cls):
- rmap[cls] = []
- classes.append(cls)
- rmap[cls].append((n,t,o,e))
- r = [(cls, rmap[cls]) for cls in classes]
- return r
-
-
- def getReportAttributes(self, result):
- """
- Return report attributes as a list of (name, value).
- Override this to add custom attributes.
- """
- startTime = str(self.startTime)[:19]
- duration = str(self.stopTime - self.startTime)
- status = []
- if result.success_count: status.append('Pass %s' % result.success_count)
- if result.failure_count: status.append('Failure %s' % result.failure_count)
- if result.error_count: status.append('Error %s' % result.error_count )
- if status:
- status = ' '.join(status)
- else:
- status = 'none'
- return [
- ('Start Time', startTime),
- ('Duration', duration),
- ('Status', status),
- ]
-
-
- def generateReport(self, test, result):
- report_attrs = self.getReportAttributes(result)
- generator = 'HTMLTestRunner %s' % __version__
- stylesheet = self._generate_stylesheet()
- heading = self._generate_heading(report_attrs)
- report = self._generate_report(result)
- ending = self._generate_ending()
- output = self.HTML_TMPL % dict(
- title = saxutils.escape(self.title),
- generator = generator,
- stylesheet = stylesheet,
- heading = heading,
- report = report,
- ending = ending,
- )
- self.stream.write(output.encode('utf8'))
-
-
- def _generate_stylesheet(self):
- return self.STYLESHEET_TMPL
-
-
- def _generate_heading(self, report_attrs):
- a_lines = []
- for name, value in report_attrs:
- line = self.HEADING_ATTRIBUTE_TMPL % dict(
- name = saxutils.escape(name),
- value = saxutils.escape(value),
- )
- a_lines.append(line)
- heading = self.HEADING_TMPL % dict(
- title = saxutils.escape(self.title),
- parameters = ''.join(a_lines),
- description = saxutils.escape(self.description),
- )
- return heading
-
-
- def _generate_report(self, result):
- rows = []
- sortedResult = self.sortResult(result.result)
- for cid, (cls, cls_results) in enumerate(sortedResult):
- # subtotal for a class
- np = nf = ne = 0
- for n,t,o,e in cls_results:
- if n == 0: np += 1
- elif n == 1: nf += 1
- else: ne += 1
-
- # format class description
- if cls.__module__ == "__main__":
- name = cls.__name__
- else:
- name = "%s.%s" % (cls.__module__, cls.__name__)
- doc = cls.__doc__ and cls.__doc__.split("\n")[0] or ""
- desc = doc and '%s: %s' % (name, doc) or name
-
- row = self.REPORT_CLASS_TMPL % dict(
- style = ne > 0 and 'errorClass' or nf > 0 and 'failClass' or 'passClass',
- desc = desc,
- count = np+nf+ne,
- Pass = np,
- fail = nf,
- error = ne,
- cid = 'c%s' % (cid+1),
- )
- rows.append(row)
-
- for tid, (n,t,o,e) in enumerate(cls_results):
- self._generate_report_test(rows, cid, tid, n, t, o, e)
-
- report = self.REPORT_TMPL % dict(
- test_list = ''.join(rows),
- count = str(result.success_count+result.failure_count+result.error_count),
- Pass = str(result.success_count),
- fail = str(result.failure_count),
- error = str(result.error_count),
- )
- return report
-
-
- def _generate_report_test(self, rows, cid, tid, n, t, o, e):
- # e.g. 'pt1.1', 'ft1.1', etc
- has_output = bool(o or e)
- tid = (n == 0 and 'p' or 'f') + 't%s.%s' % (cid+1,tid+1)
- name = t.id().split('.')[-1]
- doc = t.shortDescription() or ""
- desc = doc and ('%s: %s' % (name, doc)) or name
- tmpl = has_output and self.REPORT_TEST_WITH_OUTPUT_TMPL or self.REPORT_TEST_NO_OUTPUT_TMPL
-
- # o and e should be byte string because they are collected from stdout and stderr?
- if isinstance(o,str):
- # TODO: some problem with 'string_escape': it escape \n and mess up formating
- # uo = unicode(o.encode('string_escape'))
- uo = o.decode('latin-1')
- else:
- uo = o
- if isinstance(e,str):
- # TODO: some problem with 'string_escape': it escape \n and mess up formating
- # ue = unicode(e.encode('string_escape'))
- ue = e.decode('latin-1')
- else:
- ue = e
-
- script = self.REPORT_TEST_OUTPUT_TMPL % dict(
- id = tid,
- output = saxutils.escape(uo+ue),
- )
-
- row = tmpl % dict(
- tid = tid,
- Class = (n == 0 and 'hiddenRow' or 'none'),
- style = n == 2 and 'errorCase' or (n == 1 and 'failCase' or 'none'),
- desc = desc,
- script = script,
- status = self.STATUS[n],
- )
- rows.append(row)
- if not has_output:
- return
-
- def _generate_ending(self):
- return self.ENDING_TMPL
-
-
-##############################################################################
-# Facilities for running tests from the command line
-##############################################################################
-
-# Note: Reuse unittest.TestProgram to launch test. In the future we may
-# build our own launcher to support more specific command line
-# parameters like test title, CSS, etc.
-class TestProgram(unittest.TestProgram):
- """
- A variation of the unittest.TestProgram. Please refer to the base
- class for command line parameters.
- """
- def runTests(self):
- # Pick HTMLTestRunner as the default test runner.
- # base class's testRunner parameter is not useful because it means
- # we have to instantiate HTMLTestRunner before we know self.verbosity.
- if self.testRunner is None:
- self.testRunner = HTMLTestRunner(verbosity=self.verbosity)
- unittest.TestProgram.runTests(self)
-
-main = TestProgram
-
-##############################################################################
-# Executing this module from the command line
-##############################################################################
-
-if __name__ == "__main__":
- main(module=None)
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import tempfile
-import sys
-import subprocess
-import time
-
-class outRedirection():
- '''redirection of standart output
- useful for testing the terminal display
- '''
- def __init__(self):
- '''initialization
- '''
- self._fstream = tempfile.NamedTemporaryFile(mode='w')
- self.saveout = sys.stdout
- sys.stdout = self._fstream
-
- def flush(self):
- self._fstream.flush()
-
- def end_redirection(self):
- self._fstream.seek(0)
- ff = open(self._fstream.name, 'r')
- self.res = ff.read()
- self._fstream.close()
- sys.stdout = self.saveout
-
- def read_results(self):
- try:
- return self.res
- except Exception as exc:
- print('Problem with redirection : %s' % exc)
- sys.exit(1)
-
-def kill9(pid):
- subprocess.call("kill -9 " + pid, shell=True)
-
-def check_proc_existence_and_kill(regex):
- cmd = 'ps aux | grep "' + regex + '"'
- psRes = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
- psRes = psRes.split('\n')
- for line in psRes:
- if 'grep' in line or len(line) == 0:
- continue
- line2 = [i for i in line.split(' ') if i != '']
- pid = line2[1]
- kill9(pid)
- return pid
- return 0
-
-def check_proc_existence_and_kill_multi(regex, nb_kills, time_between_two_checks = 1):
- found = False
- i = 0
- while not found and i < nb_kills :
- found = check_proc_existence_and_kill(regex)
- if found:
- return found
- time.sleep(time_between_two_checks)
- i+=1
- return 0
\ No newline at end of file
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
import src.product
-
from salomeTools import Sat
-import HTMLTestRunner
-class TestCompile(unittest.TestCase):
- '''Test of the compile command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the compile command"""
- def test_compile(self):
- '''Test the compile command with --products option
- '''
+ def test_010(self):
+ # Test the compile command with '--products' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_fathers(self):
- '''Test the configure command with --fathers option
- '''
+ def test_020(self):
+ # Test the configure command with '--fathers' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_children(self):
- '''Test the configure command with --children option
- '''
+ def test_030(self):
+ # Test the configure command with '--children' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_clean_all(self):
- '''Test the configure command with --clean_all option
- '''
+ def test_040(self):
+ # Test the configure command with '--clean_all' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_clean_install(self):
- '''Test the configure command with --clean_install option
- '''
+ def test_050(self):
+ # Test the configure command with '--clean_install' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_makeflags(self):
- '''Test the configure command with --make_flags option
- '''
+ def test_060(self):
+ # Test the configure command with '--make_flags' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_show(self):
- '''Test the configure command with --show option
- '''
+ def test_070(self):
+ # Test the configure command with '--show' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_compile_stop_first_fail(self):
- '''Test the configure command with --stop_first_fail option
- '''
+ def test_080(self):
+ # Test the configure command with '--stop_first_fail' option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h compile
- '''
+ def test_090(self):
+ # Test the 'sat -h compile' command to get description
OK = "KO"
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
+
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
import src.product
+from src.salomeTools import Sat
+
+class TestCase(unittest.TestCase):
+ """Test of the configure command"""
-from salomeTools import Sat
-import HTMLTestRunner
+ def setUp(self):
+ print("setUp")
-class TestConfigure(unittest.TestCase):
- '''Test of the configure command
- '''
+ def tearDown(self):
+ print("tearDown")
- def test_configure_cmake(self):
- '''Test the configure command with a product in cmake
- '''
+ def test_010(self):
+ # Test the configure command with a product in cmake
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_configure_autotools(self):
- '''Test the configure command with a product in autotools
- '''
+ def test_020(self):
+ # Test the configure command with a product in autotools
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_configure_script(self):
- '''Test the configure command with a product in script mode
- '''
+ def test_030(self):
+ # Test the configure command with a product in script mode
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h configure
- '''
-
+ def test_040(self):
+ # Test the 'sat -h configure'
OK = "KO"
import configure
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
import src.product
-
from salomeTools import Sat
-import HTMLTestRunner
-class TestMake(unittest.TestCase):
- '''Test of the make command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the make command"""
- def test_make(self):
- '''Test the configure command without any option
- '''
+ def test_010(self):
+ # Test the configure command without any option
OK = 'KO'
appli = 'appli-test'
expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
expected_file_path = os.path.join(expected_build_dir, 'hello')
- sat.configure(appli + ' --product ' + product_name)
-
+ sat.configure(appli + ' --product ' + product_name)
sat.make(appli + ' --product ' + product_name)
if os.path.exists(os.path.join(expected_build_dir, expected_file_path)):
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_make_option(self):
- '''Test the make command with an option
- '''
+ def test_020(self):
+ # Test the make command with an option
OK = 'KO'
-
appli = 'appli-test'
product_name = 'PRODUCT_GIT'
expected_build_dir = src.product.get_product_config(sat.cfg, product_name).build_dir
expected_file_path = os.path.join(expected_build_dir, 'hello')
- sat.configure(appli + ' --product ' + product_name)
-
+ sat.configure(appli + ' --product ' + product_name)
sat.make(appli + ' --product ' + product_name + ' --option -j3')
if os.path.exists(os.path.join(expected_build_dir, expected_file_path)):
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_make_script(self):
- '''Test the make command with a product in script mode
- '''
+ def test_030(self):
+ # Test the make command with a product in script mode
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h make
- '''
-
+ def test_040(self):
+ # Test the sat -h make
OK = "KO"
import make
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
import src.product
-
from salomeTools import Sat
-import HTMLTestRunner
class TestMakeinstall(unittest.TestCase):
- '''Test of the makeinstall command
- '''
+ """Test of the makeinstall command"""
- def test_makeinstall(self):
- '''Test the configure command without any option
- '''
+ def test_010(self):
+ # Test the configure-make-makeinstall command without any option
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h make
- '''
-
+ def test_020(self):
+ # Test the sat -h make
OK = "KO"
import makeinstall
- if "The makeinstall command executes the \"make install\" command" in makeinstall.description():
+ if "The makeinstall command executes the 'make install' command" in makeinstall.description():
OK = "OK"
# pyunit method to compare 2 str
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import shutil
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-
-from salomeTools import Sat
-import HTMLTestRunner
-
-class TestConfig(unittest.TestCase):
- '''pyunit class : each method execute one test.
- '''
-
- def test_user_dir_creation(self):
- '''Creation of ~/.salomeTools/salomeTools.pyconf
- '''
- res = "KO"
- user_dir = os.path.expanduser(os.path.join('~','.salomeTools'))
- user_dir_save = os.path.expanduser(os.path.join('~','.salomeTools_save'))
- if os.path.exists(user_dir_save):
- shutil.rmtree(user_dir_save)
- if os.path.exists(user_dir):
- shutil.move(user_dir, user_dir_save)
-
- # The command to test
- sat = Sat('')
- sat.config('-v .')
-
- expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'salomeTools.pyconf'))
-
- if os.path.exists(expected_file):
- res = "OK"
-
- shutil.rmtree(user_dir)
- shutil.move(user_dir_save, user_dir)
-
- # pyunit method to compare 2 str
- self.assertEqual(res, "OK")
-
- def test_override_VARS(self):
- '''override VARS
- '''
- OK = "KO"
-
- # The command to test
- sat = Sat("-oVARS.user='user_test'")
- sat.config()
-
- if sat.cfg.VARS.user == 'user_test':
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_override_INTERNAL(self):
- '''override INTERNAL
- '''
- OK = "KO"
-
- # The command to test
- sat = Sat("-oINTERNAL.sat_version='V0'")
- sat.config()
-
- if sat.cfg.INTERNAL.sat_version == 'V0':
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- """
- def test_override_SITE(self):
- '''override SITE
- '''
- OK = "KO"
-
- # The command to test
- sat = Sat("-oSITE.jobs.config_path='/tmp'")
- sat.config()
-
- if sat.cfg.SITE.jobs.config_path == '/tmp':
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
- """
-
- def test_override_APPLICATION(self):
- '''override APPLICATION
- '''
- OK = "KO"
-
- # The command to test
- sat = Sat("-oAPPLICATION.out_dir='/tmp'")
- sat.config('appli-test')
-
- if sat.cfg.APPLICATION.out_dir == '/tmp':
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_override_PRODUCTS(self):
- '''override PRODUCTS
- '''
- OK = "KO"
-
- # The command to test
- sat = Sat("-oPRODUCTS.PRODUCT_GIT.default.name='test'")
- sat.config('')
-
- if sat.cfg.PRODUCTS.PRODUCT_GIT.default.name == 'test':
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-
-from salomeTools import Sat
-import HTMLTestRunner
-
-class TestConfig(unittest.TestCase):
- '''sat config -c
- '''
-
- def test_option_copy(self):
- '''Test the copy of a pyconf
- '''
- res = "KO"
- appli_to_copy = "appli-test"
-
- expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'Applications', 'LOCAL_' + appli_to_copy + '.pyconf'))
- if os.path.exists(expected_file):
- os.remove(expected_file)
-
- # The command to test
- sat = Sat('')
- sat.config('appli-test -c')
-
-
- if os.path.exists(expected_file):
- res = "OK"
- os.remove(expected_file)
-
- # pyunit method to compare 2 str
- self.assertEqual(res, "OK")
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import threading
-import time
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-
-from salomeTools import Sat
-from tools import check_proc_existence_and_kill_multi
-import HTMLTestRunner
-
-sleep_time = 3
-
-class TestConfig(unittest.TestCase):
- '''OPTION EDIT.
- '''
-
- def test_edit_userconfig(self):
- '''Test the launch of the editor when invoking the config -e
- '''
-
- OK = "KO"
-
- sat = Sat("-oUSER.editor='cooledit'")
- sat.config()
- cmd_config = threading.Thread(target=sat.config, args=('-e',))
- cmd_config.start()
-
- time.sleep(sleep_time)
-
- editor = sat.cfg.USER.editor
- pid = check_proc_existence_and_kill_multi(editor + ".*" + "salomeTools\.pyconf", 10)
-
- if pid:
- OK = "OK"
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_edit_appli(self):
- '''Test the launch of the editor when invoking the config -e appli-test
- '''
-
- OK = "KO"
-
- sat = Sat("-oUSER.editor='cooledit'")
- sat.config()
- cmd_config = threading.Thread(target=sat.config, args=('appli-test -e',))
- cmd_config.start()
-
- time.sleep(sleep_time)
-
- editor = sat.cfg.USER.editor
- pid = check_proc_existence_and_kill_multi(editor + ".*" + "appli-test\.pyconf", 10)
-
- if pid:
- OK = "OK"
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import platform
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-
-from salomeTools import Sat
-from tools import outRedirection
-import HTMLTestRunner
-
-class TestConfig(unittest.TestCase):
- '''OPTION VALUE.
- '''
-
- def test_option_value(self):
- '''Test the display of the right value of "sat config -v VARS.hostname"
- '''
-
- OK = "KO"
-
- # output redirection
- my_out = outRedirection()
-
- # The command to test
- sat = Sat()
- sat.config('-v VARS.hostname')
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
- if platform.node() in res:
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_list(self):
- '''Test the display of the right value of "sat config -l"
- '''
-
- OK = "KO"
-
- # output redirection
- my_out = outRedirection()
-
- # The command to test
- sat = Sat()
- sat.config('-l')
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
- # get results
- if "ERROR" not in res:
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- """
- def test_error_salomeToolspyconf(self):
- '''Test the exception when salomeTools.pyconf has errors
- '''
-
- OK = "KO"
-
- # The command to test
- sat = Sat()
- sat.config()
-
- salomeToolspyconfPath = os.path.join(sat.cfg.VARS.srcDir, "internal_config", "salomeTools.pyconf")
- salomeToolspyconfPath_save = os.path.join(sat.cfg.VARS.srcDir, "internal_config", "salomeTools.pyconf_save")
- if os.path.exists(salomeToolspyconfPath_save):
- os.remove(salomeToolspyconfPath_save)
- shutil.copyfile(salomeToolspyconfPath, salomeToolspyconfPath_save)
- f_read = open(salomeToolspyconfPath, 'r')
- text = f_read.read()
- f_read.close()
- os.remove(salomeToolspyconfPath)
- f_write = open(salomeToolspyconfPath, 'w')
- f_write.write(text.replace(':', ''))
- f_write.close()
-
- try:
- sat.config()
- except TypeError:
- OK = "OK"
- finally:
- shutil.copyfile(salomeToolspyconfPath_save, salomeToolspyconfPath)
- os.remove(salomeToolspyconfPath_save)
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
- """
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import platform
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-
-from salomeTools import Sat
-from tools import outRedirection
-import HTMLTestRunner
-
-class TestConfig(unittest.TestCase):
- '''test of sat config -v VARS.python
- '''
-
- def test_option_value(self):
- '''Test the display of the right value of "sat config -v VARS.python"
- '''
-
- OK = 'KO'
-
- # output redirection
- my_out = outRedirection()
-
- # The command to test
- sat = Sat('')
- sat.config('-v VARS.python')
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
-
- if platform.python_version() in res:
- OK = 'OK'
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, 'OK')
-
- def test_option_schema(self):
- '''Test the display of the right value of "sat config -s"
- '''
-
- OK = 'KO'
-
- # output redirection
- my_out = outRedirection()
-
- # The command to test
- sat = Sat('')
- sat.config('-s')
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
-
- if 'INTERNAL' in res:
- OK = 'OK'
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, 'OK')
-
- def test_option_info(self):
- '''Test the display of the right value of "sat config -i"
- '''
-
- application = 'appli-test'
- product = 'PRODUCT_DEV'
-
- OK = 'KO'
-
- # output redirection
- my_out = outRedirection()
-
- # The command to test
- sat = Sat('')
- sat.config(application + ' --info ' + product)
-
- # stop output redirection
- my_out.end_redirection()
-
- # get results
- res = my_out.read_results()
-
-
- if 'compilation method = cmake' in res:
- OK = 'OK'
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, 'OK')
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import shutil
+import unittest
+
+from salomeTools import Sat
+
+class TestCase(unittest.TestCase):
+ """Test create file .pyconf"""
+
+ def test_010(self):
+ # Test creation of ~/.salomeTools/salomeTools.pyconf
+ res = "KO"
+ user_dir = os.path.expanduser(os.path.join('~','.salomeTools'))
+ user_dir_save = os.path.expanduser(os.path.join('~','.salomeTools_save'))
+ if os.path.exists(user_dir_save):
+ shutil.rmtree(user_dir_save)
+ if os.path.exists(user_dir):
+ shutil.move(user_dir, user_dir_save)
+
+ # The command to test
+ sat = Sat('')
+ sat.config('-v .')
+
+ expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'salomeTools.pyconf'))
+
+ if os.path.exists(expected_file):
+ res = "OK"
+
+ shutil.rmtree(user_dir)
+ shutil.move(user_dir_save, user_dir)
+ self.assertEqual(res, "OK")
+
+ def test_020(self):
+ # Test override VARS
+ OK = "KO"
+
+ # The command to test
+ sat = Sat("-oVARS.user='user_test'")
+ sat.config()
+
+ if sat.cfg.VARS.user == 'user_test':
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_030(self):
+ # Test override INTERNAL
+ OK = "KO"
+
+ # The command to test
+ sat = Sat("-oINTERNAL.sat_version='V0'")
+ sat.config()
+
+ if sat.cfg.INTERNAL.sat_version == 'V0':
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ """
+ def test_040(self):
+ # Test override SITE
+ OK = "KO"
+
+ # The command to test
+ sat = Sat("-oSITE.jobs.config_path='/tmp'")
+ sat.config()
+
+ if sat.cfg.SITE.jobs.config_path == '/tmp':
+ OK = "OK"
+
+ self.assertEqual(OK, "OK")
+ """
+
+ def test_050(self):
+ # Test override APPLICATION
+ OK = "KO"
+
+ # The command to test
+ sat = Sat("-oAPPLICATION.out_dir='/tmp'")
+ sat.config('appli-test')
+
+ if sat.cfg.APPLICATION.out_dir == '/tmp':
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_060(self):
+ # Test override PRODUCTS
+ OK = "KO"
+
+ # The command to test
+ sat = Sat("-oPRODUCTS.PRODUCT_GIT.default.name='test'")
+ sat.config('')
+
+ if sat.cfg.PRODUCTS.PRODUCT_GIT.default.name == 'test':
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import unittest
+
+from salomeTools import Sat
+
+class TestCase(unittest.TestCase):
+ """sat config --copy"""
+
+ def test_010(self):
+ # Test the copy of a pyconf
+ res = "KO"
+ appli_to_copy = "appli-test"
+
+ expected_file = os.path.expanduser(os.path.join('~','.salomeTools', 'Applications', 'LOCAL_' + appli_to_copy + '.pyconf'))
+ if os.path.exists(expected_file):
+ os.remove(expected_file)
+
+ # The command to test
+ sat = Sat('')
+ sat.config('appli-test -c')
+
+ if os.path.exists(expected_file):
+ res = "OK"
+ os.remove(expected_file)
+ self.assertEqual(res, "OK")
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import threading
+import time
+import unittest
+
+from salomeTools import Sat
+from test.unittestpy.tools import check_proc_existence_and_kill_multi
+
+sleep_time = 2
+
+class TestCase(unittest.TestCase):
+ """sat config --edit"""
+
+ def test_010(self):
+ # Test the launch of the editor when invoking the config -e
+ OK = "KO"
+
+ sat = Sat("-oUSER.editor='cooledit'")
+ sat.config()
+ cmd_config = threading.Thread(target=sat.config, args=('-e',))
+ cmd_config.start()
+
+ time.sleep(sleep_time)
+
+ editor = sat.cfg.USER.editor
+ pid = check_proc_existence_and_kill_multi(editor + ".*" + "salomeTools\.pyconf", 10)
+
+ if pid:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_020(self):
+ # Test the launch of the editor when invoking the config -e appli-test
+ OK = "KO"
+
+ sat = Sat("-oUSER.editor='cooledit'")
+ sat.config()
+ cmd_config = threading.Thread(target=sat.config, args=('appli-test -e',))
+ cmd_config.start()
+
+ time.sleep(sleep_time)
+
+ editor = sat.cfg.USER.editor
+ pid = check_proc_existence_and_kill_multi(editor + ".*" + "appli-test\.pyconf", 10)
+
+ if pid:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import platform
+import unittest
+
+from salomeTools import Sat
+from test.unittestpy.tools import outRedirection
+
+class TestCase(unittest.TestCase):
+ """sat config --value"""
+
+ def test_010(self):
+ # Test the display of the right value of "sat config -v VARS.hostname"
+ OK = "KO"
+
+ # output redirection
+ my_out = outRedirection()
+
+ # The command to test
+ sat = Sat()
+ sat.config('-v VARS.hostname')
+
+ # stop output redirection
+ my_out.end_redirection()
+
+ # get results
+ res = my_out.read_results()
+
+ if platform.node() in res:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_020(self):
+ # Test the display of the right value of "sat config -l"
+ OK = "KO"
+
+ # output redirection
+ my_out = outRedirection()
+
+ # The command to test
+ sat = Sat()
+ sat.config('-l')
+
+ # stop output redirection
+ my_out.end_redirection()
+
+ # get results
+ res = my_out.read_results()
+
+ # get results
+ if "ERROR" not in res:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ """
+ def test_030(self):
+ # Test the exception when salomeTools.pyconf has errors
+ OK = "KO"
+
+ # The command to test
+ sat = Sat()
+ sat.config()
+
+ salomeToolspyconfPath = os.path.join(sat.cfg.VARS.srcDir, "internal_config", "salomeTools.pyconf")
+ salomeToolspyconfPath_save = os.path.join(sat.cfg.VARS.srcDir, "internal_config", "salomeTools.pyconf_save")
+ if os.path.exists(salomeToolspyconfPath_save):
+ os.remove(salomeToolspyconfPath_save)
+ shutil.copyfile(salomeToolspyconfPath, salomeToolspyconfPath_save)
+ f_read = open(salomeToolspyconfPath, 'r')
+ text = f_read.read()
+ f_read.close()
+ os.remove(salomeToolspyconfPath)
+ f_write = open(salomeToolspyconfPath, 'w')
+ f_write.write(text.replace(':', ''))
+ f_write.close()
+
+ try:
+ sat.config()
+ except TypeError:
+ OK = "OK"
+ finally:
+ shutil.copyfile(salomeToolspyconfPath_save, salomeToolspyconfPath)
+ os.remove(salomeToolspyconfPath_save)
+ self.assertEqual(OK, "OK")
+ """
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import platform
+import unittest
+
+from salomeTools import Sat
+from test.unittestpy.tools import outRedirection
+
+class TestCase(unittest.TestCase):
+ """sat config -v VARS.python"""
+
+ def test_010(self):
+ # Test the display of the right value of 'sat config -v VARS.python'
+ OK = 'KO'
+
+ # output redirection
+ my_out = outRedirection()
+
+ # The command to test
+ sat = Sat('')
+ sat.config('-v VARS.python')
+
+ # stop output redirection
+ my_out.end_redirection()
+
+ # get results
+ res = my_out.read_results()
+
+
+ if platform.python_version() in res:
+ OK = 'OK'
+ self.assertEqual(OK, 'OK')
+
+ def test_020(self):
+ # Test the display of the right value of 'sat config -s'
+ OK = 'KO'
+
+ # output redirection
+ my_out = outRedirection()
+
+ # The command to test
+ sat = Sat('')
+ sat.config('-s')
+
+ # stop output redirection
+ my_out.end_redirection()
+
+ # get results
+ res = my_out.read_results()
+
+
+ if 'INTERNAL' in res:
+ OK = 'OK'
+ self.assertEqual(OK, 'OK')
+
+ def test_030(self):
+ # Test the display of the right value of 'sat config --info'
+ application = 'appli-test'
+ product = 'PRODUCT_DEV'
+
+ OK = 'KO'
+
+ # output redirection
+ my_out = outRedirection()
+
+ # The command to test
+ sat = Sat('')
+ sat.config(application + ' --info ' + product)
+
+ # stop output redirection
+ my_out.end_redirection()
+
+ # get results
+ res = my_out.read_results()
+
+
+ if 'compilation method = cmake' in res:
+ OK = 'OK'
+ self.assertEqual(OK, 'OK')
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
class TestSource(unittest.TestCase):
- '''Test of the source command
- '''
+ """Test of the environ command"""
- def test_environ_no_option(self):
- '''Test the environ command without any option
- '''
+ def test_010(self):
+ # Test the environ command without any option
OK = 'KO'
appli = 'appli-test'
if os.path.exists(expected_file_path):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_environ_option_products(self):
- '''Test the environ command with option --products
- '''
+ def test_020(self):
+ # Test the environ command with option '--products'
OK = 'KO'
appli = 'appli-test'
if os.path.exists(expected_file_path):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_environ_option_target(self):
- '''Test the environ command with option --target
- '''
+ def test_030(self):
+ # Test the environ command with option --target
OK = 'KO'
appli = 'appli-test'
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_environ_option_prefix(self):
- '''Test the environ command with option --prefix
- '''
+ def test_040(self):
+ # Test the environ command with option --prefix
OK = 'KO'
appli = 'appli-test'
if os.path.exists(expected_file_path):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_environ_option_shell(self):
- '''Test the environ command with option --shell
- '''
+ def test_050(self):
+ # Test the environ command with option --shell
OK = 'KO'
appli = 'appli-test'
if os.path.exists(expected_file_path):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
-class TestJob(unittest.TestCase):
- '''Test of the job command
- '''
+class TestCase(unittest.TestCase):
+ """Test the job command"""
- def test_job(self):
- '''Test the job command
- '''
+ def test_010(self):
+ # Test the job command
OK = 'KO'
tmp_file = "/tmp/test.txt"
if "nb_proc" in text:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_failing_job(self):
- '''Test the job command with a failing command
- '''
+ def test_020(self):
+ # Test the job command with a failing command
OK = 'KO'
tmp_file = "/tmp/test.txt"
# pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_file_conf_not_found(self):
- '''Test the job command with a wrong file configuration
- '''
+ def test_030(self):
+ # Test the job command with a wrong file configuration
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_no_option_jobs_config(self):
- '''Test the job command without --jobs_config option
- '''
+ def test_040(self):
+ # Test the job command without --jobs_config option
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_job_not_found(self):
- '''Test the job command without --jobs_config option
- '''
+ def test_050(self):
+ # Test the job command without --jobs_config option
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h job
- '''
-
+ def test_060(self):
+ # Test the sat -h job
OK = "KO"
import job
if "Executes the commands of the job defined in the jobs configuration file" in job.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
from salomeTools import Sat
-from tools import outRedirection
-import HTMLTestRunner
+from test.unittestpy.tools import outRedirection
-class TestJobs(unittest.TestCase):
- '''Test of the jobs command
- '''
+class TestCase(unittest.TestCase):
+ "Test the jobs command"""
- def test_jobs(self):
- '''Test the jobs command
- '''
+ def test_010(self):
+ # Test the jobs command
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 0:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_jobs_only_jobs(self):
- '''Test the jobs command with option --only_jobs
- '''
+ def test_020(self):
+ # Test the jobs command with option --only_jobs
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 0:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_no_option_name(self):
- '''Test the jobs command without --name option
- '''
+ def test_030(self):
+ # Test the jobs command without --name option
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_file_conf_not_found(self):
- '''Test the jobs command with a wrong file configuration
- '''
+ def test_040(self):
+ # Test the jobs command with a wrong file configuration
OK = 'KO'
tmp_file = "/tmp/test.txt"
if res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_option_list(self):
- '''Test the display of the right value of "sat jobs --list"
- '''
-
+ def test_050(self):
+ # Test the display of the right value of 'sat jobs --list'
OK = "KO"
# output redirection
# get results
if "ERROR" not in res:
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_description(self):
- '''Test the sat -h jobs
- '''
-
+ def test_060(self):
+ # Test the sat -h jobs
OK = "KO"
import jobs
if "The jobs command launches maintenances that are described in the dedicated jobs configuration file." in jobs.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import threading
-import time
-import shutil
-import io
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
-
-from salomeTools import Sat
-from tools import check_proc_existence_and_kill_multi
-import HTMLTestRunner
-
-sleep_time = 2
-
-class TestLog(unittest.TestCase):
- '''Test of log command: launch of browser
- '''
-
- def test_write_xmllog(self):
- '''Test the write of xml log when invoking a command
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
- sat.config('appli-test -v USER.browser')
-
- # get log file path
- logDir = sat.cfg.USER.log_dir
- logPath = os.path.join(logDir, sat.cfg.VARS.datehour + "_" + sat.cfg.VARS.command + ".xml")
-
- if os.path.exists(logPath):
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal(self):
- '''Test the terminal option without application
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- one = u"1"
- sys.stdin = io.StringIO(one)
-
-
- try:
- sat.log('-t')
- OK = "OK"
- sys.stdin = sys.__stdin__
- except:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal2(self):
- '''Test the terminal option with application
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('appli-test -v VARS.python')
-
- one = u"1"
- sys.stdin = io.StringIO(one)
-
- try:
- sat.log('appli-test -t --last')
- OK = "OK"
- sys.stdin = sys.__stdin__
- except:
- pass
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal3(self):
- '''Test the terminal option with 0 as input
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('appli-test -v VARS.python')
-
- zero = u"0\n1"
- sys.stdin = io.StringIO(zero)
-
- try:
- sat.log('--terminal')
- OK = "OK"
- finally:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal4(self):
- '''Test the terminal option with input bigger than the number of logs
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('appli-test -v VARS.python')
-
- nb_logs = len(os.listdir(sat.cfg.USER.log_dir))
-
- nb_logs_u = unicode(str(nb_logs) + "\n1")
- sys.stdin = io.StringIO(nb_logs_u)
-
- try:
- sat.log('--terminal')
- OK = "OK"
- finally:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal5(self):
- '''Test the terminal option with input return
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('appli-test -v VARS.python')
-
- ret = unicode("\n0")
- sys.stdin = io.StringIO(ret)
-
- try:
- sat.log('--terminal')
- OK = "OK"
- finally:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal6(self):
- '''Test the terminal option with input not int
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('appli-test -v VARS.python')
-
- ret = unicode("blabla\n0")
- sys.stdin = io.StringIO(ret)
-
- try:
- sat.log('--terminal')
- OK = "OK"
- finally:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_terminal7(self):
- '''Test the terminal option and option last
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- try:
- sat.log('--terminal --last')
- OK = "OK"
- finally:
- sys.stdin = sys.__stdin__
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_last(self):
- '''Test the option --last
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat("-oUSER.browser='konqueror'")
-
- sat.config('appli-test -v VARS.python')
-
-
- time.sleep(sleep_time)
- cmd_log = threading.Thread(target=sat.log, args=('appli-test --last',))
- cmd_log.start()
-
- time.sleep(sleep_time)
-
- browser = sat.cfg.USER.browser
- pid = check_proc_existence_and_kill_multi(browser + ".*" + "xml", 10)
-
- if pid:
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_clean(self):
- '''Test the option --clean
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('-v VARS.user')
-
- nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
-
- sat.log('--clean 1')
-
- nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
-
- if nb_logs_t1-nb_logs_t0 == 0:
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- def test_option_clean2(self):
- '''Test the option --clean with big number of files to clean
- '''
-
- OK = "KO"
-
- # launch the command that will write a log
- sat = Sat()
-
- sat.config('-v VARS.user')
-
- nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
-
- if os.path.exists(sat.cfg.USER.log_dir + "_save"):
- shutil.rmtree(sat.cfg.USER.log_dir + "_save")
- shutil.copytree(sat.cfg.USER.log_dir,sat.cfg.USER.log_dir + "_save")
-
- sat.log('--clean ' + str(nb_logs_t0))
-
- nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
-
- shutil.rmtree(sat.cfg.USER.log_dir)
- shutil.move(sat.cfg.USER.log_dir + "_save", sat.cfg.USER.log_dir)
-
- if nb_logs_t0-nb_logs_t1 > 10:
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
- """
- def test_option_full(self):
- '''Test the option --full
- '''
-
- OK = "KO"
-
- sat = Sat("-oUSER.browser='konqueror'")
- time.sleep(sleep_time)
- cmd_log = threading.Thread(target=sat.log, args=('--full',))
- cmd_log.start()
-
- time.sleep(sleep_time)
-
- browser = sat.cfg.USER.browser
- check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
-
- # Read and check the hat.xml file contains at least one log file corresponding to log
- hatFilePath = os.path.join(sat.cfg.USER.log_dir, "hat.xml")
- xmlHatFile = src.xmlManager.ReadXmlFile(hatFilePath)
- for field in xmlHatFile.xmlroot:
- if field.attrib[b'cmd'] == b'log':
- OK = "OK"
- break
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
- """
- def test_description(self):
- '''Test the sat -h log
- '''
-
- OK = "KO"
-
- import log
-
- if "Gives access to the logs produced" in log.description():
- OK = "OK"
-
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-import unittest
-import os
-import sys
-import threading
-import time
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
-
-from salomeTools import Sat
-from tools import check_proc_existence_and_kill_multi
-import HTMLTestRunner
-
-sleep_time = 2
-
-class TestLog(unittest.TestCase):
- '''Test of log command: launch of browser
- '''
- def test_launch_browser(self):
- '''Test the launch of browser when invoking the log command
- '''
-
- OK = "KO"
-
- sat = Sat("-oUSER.browser='konqueror'")
- time.sleep(sleep_time)
- cmd_log = threading.Thread(target=sat.log, args=('',))
- cmd_log.start()
-
- time.sleep(sleep_time)
-
- sat.config("")
- browser = sat.cfg.USER.browser
- pid = check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
-
- if pid:
- OK = "OK"
- # pyunit method to compare 2 str
- self.assertEqual(OK, "OK")
-
-# test launch
-if __name__ == '__main__':
- HTMLTestRunner.main()
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import threading
+import time
+import shutil
+import io
+import unittest
+
+from salomeTools import Sat
+from test.unittestpy.tools import check_proc_existence_and_kill_multi
+
+sleep_time = 2
+
+class TestCase(unittest.TestCase):
+ """Test of log command: launch of browser"""
+
+ def test_010(self):
+ # Test the write of xml log when invoking a command
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+ sat.config('appli-test -v USER.browser')
+
+ # get log file path
+ logDir = sat.cfg.USER.log_dir
+ logPath = os.path.join(logDir, sat.cfg.VARS.datehour + "_" + sat.cfg.VARS.command + ".xml")
+
+ if os.path.exists(logPath):
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_020(self):
+ # Test the terminal option without application
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ one = u"1"
+ sys.stdin = io.StringIO(one)
+
+
+ try:
+ sat.log('-t')
+ OK = "OK"
+ sys.stdin = sys.__stdin__
+ except:
+ sys.stdin = sys.__stdin__
+ self.assertEqual(OK, "OK")
+
+ def test_030(self):
+ # Test the terminal option with application
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('appli-test -v VARS.python')
+
+ one = u"1"
+ sys.stdin = io.StringIO(one)
+
+ try:
+ sat.log('appli-test -t --last')
+ OK = "OK"
+ sys.stdin = sys.__stdin__
+ except:
+ pass
+ self.assertEqual(OK, "OK")
+
+ def test_040(self):
+ # Test the terminal option with 0 as input
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('appli-test -v VARS.python')
+
+ zero = u"0\n1"
+ sys.stdin = io.StringIO(zero)
+
+ try:
+ sat.log('--terminal')
+ OK = "OK"
+ finally:
+ sys.stdin = sys.__stdin__
+ self.assertEqual(OK, "OK")
+
+ def test_050(self):
+ # Test the terminal option with input bigger than the number of logs
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('appli-test -v VARS.python')
+
+ nb_logs = len(os.listdir(sat.cfg.USER.log_dir))
+
+ nb_logs_u = unicode(str(nb_logs) + "\n1")
+ sys.stdin = io.StringIO(nb_logs_u)
+
+ try:
+ sat.log('--terminal')
+ OK = "OK"
+ finally:
+ sys.stdin = sys.__stdin__
+ self.assertEqual(OK, "OK")
+
+ def test_060(self):
+ # Test the terminal option with input return
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('appli-test -v VARS.python')
+
+ ret = unicode("\n0")
+ sys.stdin = io.StringIO(ret)
+
+ try:
+ sat.log('--terminal')
+ OK = "OK"
+ finally:
+ sys.stdin = sys.__stdin__
+ self.assertEqual(OK, "OK")
+
+ def test_070(self):
+ # Test the terminal option with input not int
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('appli-test -v VARS.python')
+
+ ret = unicode("blabla\n0")
+ sys.stdin = io.StringIO(ret)
+
+ try:
+ sat.log('--terminal')
+ OK = "OK"
+ finally:
+ sys.stdin = sys.__stdin__
+ self.assertEqual(OK, "OK")
+
+ def test_080(self):
+ # Test the terminal option and option last
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ try:
+ sat.log('--terminal --last')
+ OK = "OK"
+ finally:
+ sys.stdin = sys.__stdin__
+
+ # pyunit method to compare 2 str
+ self.assertEqual(OK, "OK")
+
+ def test_090(self):
+ # Test the option --last
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat("-oUSER.browser='konqueror'")
+
+ sat.config('appli-test -v VARS.python')
+
+
+ time.sleep(sleep_time)
+ cmd_log = threading.Thread(target=sat.log, args=('appli-test --last',))
+ cmd_log.start()
+
+ time.sleep(sleep_time)
+
+ browser = sat.cfg.USER.browser
+ pid = check_proc_existence_and_kill_multi(browser + ".*" + "xml", 10)
+
+ if pid:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_100(self):
+ # Test the option --clean
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('-v VARS.user')
+
+ nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
+
+ sat.log('--clean 1')
+
+ nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
+
+ if nb_logs_t1-nb_logs_t0 == 0:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+ def test_120(self):
+ # Test the option --clean with big number of files to clean
+ OK = "KO"
+
+ # launch the command that will write a log
+ sat = Sat()
+
+ sat.config('-v VARS.user')
+
+ nb_logs_t0 = len(os.listdir(sat.cfg.USER.log_dir))
+
+ if os.path.exists(sat.cfg.USER.log_dir + "_save"):
+ shutil.rmtree(sat.cfg.USER.log_dir + "_save")
+ print("TODO: risky !!!copytree!!!", sat.cfg.USER.log_dir, sat.cfg.USER.log_dir + "_save")
+ """
+ shutil.copytree(sat.cfg.USER.log_dir,sat.cfg.USER.log_dir + "_save")
+
+ sat.log('--clean ' + str(nb_logs_t0))
+
+ nb_logs_t1 = len(os.listdir(sat.cfg.USER.log_dir))
+
+ shutil.rmtree(sat.cfg.USER.log_dir)
+ shutil.move(sat.cfg.USER.log_dir + "_save", sat.cfg.USER.log_dir)
+
+ if nb_logs_t0-nb_logs_t1 > 10:
+ OK = "OK"
+ """
+ self.assertEqual(OK, "OK")
+
+ """
+ def test_130(self):
+ # Test the option --full
+ OK = "KO"
+
+ sat = Sat("-oUSER.browser='konqueror'")
+ time.sleep(sleep_time)
+ cmd_log = threading.Thread(target=sat.log, args=('--full',))
+ cmd_log.start()
+
+ time.sleep(sleep_time)
+
+ browser = sat.cfg.USER.browser
+ check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
+
+ # Read and check the hat.xml file contains at least one log file corresponding to log
+ hatFilePath = os.path.join(sat.cfg.USER.log_dir, "hat.xml")
+ xmlHatFile = src.xmlManager.ReadXmlFile(hatFilePath)
+ for field in xmlHatFile.xmlroot:
+ if field.attrib[b'cmd'] == b'log':
+ OK = "OK"
+ break
+ self.assertEqual(OK, "OK")
+ """
+
+ def test_140(self):
+ # Test the sat -h log
+ OK = "KO"
+
+ import log
+
+ if "Gives access to the logs produced" in log.description():
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+
+# Copyright (C) 2010-2018 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import os
+import sys
+import threading
+import time
+import unittest
+
+from salomeTools import Sat
+from test.unittestpy.tools import check_proc_existence_and_kill_multi
+
+sleep_time = 2
+
+class TestCase(unittest.TestCase):
+ """Test of log command: launch of browser"""
+
+ def test_010(self):
+ # Test the launch of browser when invoking the log command
+ OK = "KO"
+
+ sat = Sat("-oUSER.browser='konqueror'")
+ time.sleep(sleep_time)
+ cmd_log = threading.Thread(target=sat.log, args=('',))
+ cmd_log.start()
+
+ time.sleep(sleep_time)
+
+ sat.config("")
+ browser = sat.cfg.USER.browser
+ pid = check_proc_existence_and_kill_multi(browser + ".*" + "hat\.xml", 10)
+
+ if pid:
+ OK = "OK"
+ self.assertEqual(OK, "OK")
+
+# test launch
+if __name__ == '__main__':
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
-
-from tools import outRedirection
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
-
import src.product
-class TestClean(unittest.TestCase):
- '''Test of the clean command
- '''
+from test.unittestpy.tools import outRedirection
- def test_clean_no_args(self):
- '''Test the clean command with no arguments (nothing to clean)
- '''
+class TestCase(unittest.TestCase):
+ """Test of the clean command"""
+
+ def test_010(self):
+ # Test the clean command with no arguments (nothing to clean)
OK = 'KO'
appli = 'appli-test'
if "Nothing to suppress" in res:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_clean_sources(self):
- '''Test the clean of sources
- '''
+ def test_020(self):
+ # Test the clean of sources
OK = "KO"
appli = 'appli-test'
if not os.path.exists(expected_src_dir):
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_clean_build(self):
- '''Test the clean of build
- '''
+ def test_030(self):
+ # Test the clean of build
OK = "KO"
appli = 'appli-test'
if not os.path.exists(expected_build_dir):
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_clean_install(self):
- '''Test the clean of install
- '''
+ def test_040(self):
+ # Test the clean of install
OK = "KO"
appli = 'appli-test'
if not os.path.exists(expected_install_dir):
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_clean_all(self):
- '''Test the clean of all (build, src, install)
- '''
+ def test_050(self):
+ # Test the clean of all (build, src, install)
OK = "KO"
appli = 'appli-test'
if not os.path.exists(expected_install_dir) and not os.path.exists(expected_build_dir) and not os.path.exists(expected_src_dir):
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_clean_sources_without_dev(self):
- '''Test the clean with sources_without_dev option
- '''
+ def test_060(self):
+ # Test the clean with sources_without_dev option
OK = "KO"
appli = 'appli-test'
if not os.path.exists(expected_src_dir) and os.path.exists(expected_src_dir2):
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
- def test_description(self):
- '''Test the sat -h clean
- '''
-
+ def test_070(self):
+ # Test the sat -h clean
OK = "KO"
import clean
if "The clean command suppress the source, build, or install" in clean.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
import shutil
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
-
-from tools import outRedirection
-
-import src.product
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
+import src.product
+from test.unittestpy.tools import outRedirection
-class TestPatch(unittest.TestCase):
- '''Test of the patch command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the patch command"""
- def test_patch_dev(self):
- '''Test the patch command with a product in dev mode
- '''
+ def test_010(self):
+ # Test the patch command with a product in dev mode
OK = 'KO'
appli = 'appli-test'
if (OK1, OK2)==('OK', 'OK'):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_no_sources_found(self):
- '''Test the patch command with a product with no sources found
- '''
+ def test_020(self):
+ # Test the patch command with a product with no sources found
OK = 'KO'
appli = 'appli-test'
if "No sources found for the " + product_name +" product" in res:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_no_patch(self):
- '''Test the patch command with a product without patch
- '''
+ def test_030(self):
+ # Test the patch command with a product without patch
OK = 'KO'
appli = 'appli-test'
if "No patch for the " + product_name +" product" in res:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_invalid_patch(self):
- '''Test the patch command with a product with a not valid patch
- '''
+ def test_040(self):
+ # Test the patch command with a product with a not valid patch
OK = 'KO'
appli = 'appli-test'
if "Not a valid patch" in res:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h patch
- '''
-
+ def test_050(self):
+ # Test the sat -h patch
OK = "KO"
import patch
if "The patch command apply the patches on the sources of" in patch.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
import shutil
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
import src
-
from salomeTools import Sat
-import HTMLTestRunner
-class TestPrepare(unittest.TestCase):
- '''Test of the prepare command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the prepare command"""
- def test_prepare_dev(self):
- '''Test the prepare command with a product in dev mode
- '''
+ def test_010(self):
+ # Test the prepare command with a product in dev mode
OK = 'KO'
appli = 'appli-test'
text = f.readlines()[0]
if text == expected_text:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_prepare_all(self):
- '''Test the prepare command with all products
- '''
+ def test_020(self):
+ # Test the prepare command with all products
OK = 'KO'
appli = 'appli-test'
text = f.readlines()[0]
if text == expected_text:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_prepare_option_sample_and_force(self):
- '''Test the prepare command with all products
- '''
+ def test_030(self):
+ # Test the prepare command with all products
OK = 'KO'
appli = 'appli-test'
OK = 'OK'
except:
pass
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h prepare
- '''
-
+ def test_040(self):
+ # Test the sat -h prepare
OK = "KO"
import prepare
if "The prepare command gets the sources" in prepare.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
-
-from tools import outRedirection
-
-import src.product
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
+import src.product
+from test.unittestpy.tools import outRedirection
-class TestSource(unittest.TestCase):
- '''Test of the source command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the source command"""
- def test_source_archive(self):
- '''Test the source command with archive product
- '''
+ def test_010(self):
+ # Test the source command with archive product
appli = 'appli-test'
product_name = 'PRODUCT_ARCHIVE'
f = open(expected_file_path, 'r')
text = f.read()
-
- # pyunit method to compare 2 str
self.assertEqual(text, expected_text)
- def test_source_git(self):
- '''Test the source command with git product
- '''
+ def test_020(self):
+ # Test the source command with git product
appli = 'appli-test'
product_name = 'PRODUCT_GIT'
f = open(expected_file_path, 'r')
text = f.read()
-
- # pyunit method to compare 2 str
self.assertEqual(text, expected_text)
- def test_source_cvs(self):
- '''Test the source command with cvs product
- '''
+ def test_030(self):
+ # Test the source command with cvs product
appli = 'appli-test'
product_name = 'PRODUCT_CVS'
self.assertEqual(text, expected_text)
"""
- def test_source_svn(self):
- '''Test the source command with svn product
- '''
+ def test_040(self):
+ # Test the source command with svn product
OK = 'KO'
appli = 'appli-test'
self.assertEqual(OK, 'OK')
"""
- def test_source_native(self):
- '''Test the source command with native product
- '''
+ def test_050(self):
+ # Test the source command with native product
OK = 'KO'
appli = 'appli-test'
expected_src_dir = os.path.join(sat.cfg.APPLICATION.workdir, 'SOURCES', product_name)
if not os.path.exists(expected_src_dir):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_source_fixed(self):
- '''Test the source command with fixed product
- '''
+ def test_060(self):
+ # Test the source command with fixed product
OK = 'KO'
appli = 'appli-test'
if os.path.exists(expected_src_dir):
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- """
- def test_source_unknown(self):
- '''Test the source command with unknown product
- '''
+
+ """
+ def test_070(self):
+ # Test the source command with unknown product
OK = 'KO'
# output redirection
if "Unknown get source method" in res:
OK = 'OK'
-
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
"""
- def test_description(self):
- '''Test the sat -h source
- '''
-
+ def test_080(self):
+ # Test the sat -h source
OK = "KO"
import source
if "gets the sources of the application" in source.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env bash
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2013 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+echo "TODO: OBSOLETE: to set as python script, may be"
echo "Begin date:"
date
echo
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
-class TestShell(unittest.TestCase):
- '''Test of the shell command
- '''
+class TestCase(unittest.TestCase):
+ """Test of the shell command"""
- def test_shell(self):
- '''Test the shell command with the --command option
- '''
+ def test_010(self):
+ # Test the shell command with the --command option
OK = 'KO'
tmp_file = "/tmp/test.txt"
if "salomeTools.py" in text:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_failing_shell(self):
- '''Test the shell command with the --command option with a failing command
- '''
+ def test_020(self):
+ # Test the shell command with the --command option with a failing command
OK = 'KO'
tmp_file = "/tmp/test.txt"
if "i_fail" in text and res == 1:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h shell
- '''
-
+ def test_030(self):
+ # Test the sat -h shell
OK = "KO"
import shell
if "Executes the shell command passed as argument" in shell.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
#!/usr/bin/env python
#-*- coding:utf-8 -*-
-# Copyright (C) 2010-2012 CEA/DEN
+
+# Copyright (C) 2010-2018 CEA/DEN
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import sys
-
-# get execution path
-testdir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join(testdir, '..', '..'))
-sys.path.append(os.path.join(testdir, '..', '_testTools'))
-sys.path.append(os.path.join(testdir, '..', '..','commands'))
+import unittest
from salomeTools import Sat
-import HTMLTestRunner
class TestTest(unittest.TestCase):
- '''Test of the test command
- '''
+ """Test of the test command"""
- def test_test(self):
- '''Test the test command
- '''
+ def test_010(self):
+ # Test the test command
OK = 'KO'
tmp_file = "/tmp/test.txt"
application = "SALOME-7.8.0"
if '<session name="light">' in text:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_PY_test(self):
- '''Test the test command with PY type
- '''
+ def test_020(self):
+ # Test the test command with PY type
OK = 'KO'
tmp_file = "/tmp/test.txt"
application = "SALOME-7.8.0"
if '<session name="PY_test_withKernel">' in text:
OK = 'OK'
- # pyunit method to compare 2 str
self.assertEqual(OK, 'OK')
- def test_description(self):
- '''Test the sat -h test
- '''
-
+ def test_030(self):
+ # Test the sat -h test
OK = "KO"
import test
if "The test command runs a test base on a SALOME installation" in test.description():
OK = "OK"
-
- # pyunit method to compare 2 str
self.assertEqual(OK, "OK")
# test launch
if __name__ == '__main__':
- HTMLTestRunner.main()
+ unittest.main()
+ pass
--- /dev/null
+"""
+A TestRunner for use with the Python unit testing framework. It
+generates a HTML report to show the result at a glance.
+
+The simplest way to use this is to invoke its main method. E.g.
+
+ import unittest
+ import HTMLTestRunner
+
+ ... define your tests ...
+
+ if __name__ == '__main__':
+ HTMLTestRunner.main()
+
+
+For more customization options, instantiates a HTMLTestRunner object.
+HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g.
+
+ # output to a file
+ fp = file('my_report.html', 'wb')
+ runner = HTMLTestRunner.HTMLTestRunner(
+ stream=fp,
+ title='My unit test',
+ description='This demonstrates the report output by HTMLTestRunner.'
+ )
+
+ # Use an external stylesheet.
+ # See the Template_mixin class for more customizable options
+ runner.STYLESHEET_TMPL = '<link rel="stylesheet" href="my_stylesheet.css" type="text/css">'
+
+ # run the test
+ runner.run(my_test_suite)
+
+
+------------------------------------------------------------------------
+Copyright (c) 2004-2007, Wai Yip Tung
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name Wai Yip Tung nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""
+
+# URL: http://tungwaiyip.info/software/HTMLTestRunner.html
+
+__author__ = "Wai Yip Tung"
+__version__ = "0.8.2"
+
+
+"""
+Change History
+
+Version 0.8.2
+* Show output inline instead of popup window (Viorel Lupu).
+
+Version in 0.8.1
+* Validated XHTML (Wolfgang Borgert).
+* Added description of test classes and test cases.
+
+Version in 0.8.0
+* Define Template_mixin class for customization.
+* Workaround a IE 6 bug that it does not treat <script> block as CDATA.
+
+Version in 0.7.1
+* Back port to Python 2.3 (Frank Horowitz).
+* Fix missing scroll bars in detail log (Podi).
+"""
+
+# TODO: color stderr
+# TODO: simplify javascript using ,ore than 1 class in the class attribute?
+
+import datetime
+import StringIO
+import sys
+import time
+import unittest
+from xml.sax import saxutils
+
+
+# ------------------------------------------------------------------------
+# The redirectors below are used to capture output during testing. Output
+# sent to sys.stdout and sys.stderr are automatically captured. However
+# in some cases sys.stdout is already cached before HTMLTestRunner is
+# invoked (e.g. calling logging.basicConfig). In order to capture those
+# output, use the redirectors for the cached stream.
+#
+# e.g.
+# >>> logging.basicConfig(stream=HTMLTestRunner.stdout_redirector)
+# >>>
+
+class OutputRedirector(object):
+ """ Wrapper to redirect stdout or stderr """
+ def __init__(self, fp):
+ self.fp = fp
+
+ def write(self, s):
+ self.fp.write(s)
+
+ def writelines(self, lines):
+ self.fp.writelines(lines)
+
+ def flush(self):
+ self.fp.flush()
+
+stdout_redirector = OutputRedirector(sys.stdout)
+stderr_redirector = OutputRedirector(sys.stderr)
+
+
+
+# ----------------------------------------------------------------------
+# Template
+
+class Template_mixin(object):
+ """
+ Define a HTML template for report customerization and generation.
+
+ Overall structure of an HTML report
+
+ HTML
+ +------------------------+
+ |<html> |
+ | <head> |
+ | |
+ | STYLESHEET |
+ | +----------------+ |
+ | | | |
+ | +----------------+ |
+ | |
+ | </head> |
+ | |
+ | <body> |
+ | |
+ | HEADING |
+ | +----------------+ |
+ | | | |
+ | +----------------+ |
+ | |
+ | REPORT |
+ | +----------------+ |
+ | | | |
+ | +----------------+ |
+ | |
+ | ENDING |
+ | +----------------+ |
+ | | | |
+ | +----------------+ |
+ | |
+ | </body> |
+ |</html> |
+ +------------------------+
+ """
+
+ STATUS = {
+ 0: 'pass',
+ 1: 'fail',
+ 2: 'error',
+ }
+
+ DEFAULT_TITLE = 'Unit Test Report'
+ DEFAULT_DESCRIPTION = ''
+
+ # ------------------------------------------------------------------------
+ # HTML Template
+
+ HTML_TMPL = r"""<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>%(title)s</title>
+ <meta name="generator" content="%(generator)s"/>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ %(stylesheet)s
+</head>
+<body>
+<script language="javascript" type="text/javascript"><!--
+output_list = Array();
+
+/* level - 0:Summary; 1:Failed; 2:All */
+function showCase(level) {
+ trs = document.getElementsByTagName("tr");
+ for (var i = 0; i < trs.length; i++) {
+ tr = trs[i];
+ id = tr.id;
+ if (id.substr(0,2) == 'ft') {
+ if (level < 1) {
+ tr.className = 'hiddenRow';
+ }
+ else {
+ tr.className = '';
+ }
+ }
+ if (id.substr(0,2) == 'pt') {
+ if (level > 1) {
+ tr.className = '';
+ }
+ else {
+ tr.className = 'hiddenRow';
+ }
+ }
+ }
+}
+
+
+function showClassDetail(cid, count) {
+ var id_list = Array(count);
+ var toHide = 1;
+ for (var i = 0; i < count; i++) {
+ tid0 = 't' + cid.substr(1) + '.' + (i+1);
+ tid = 'f' + tid0;
+ tr = document.getElementById(tid);
+ if (!tr) {
+ tid = 'p' + tid0;
+ tr = document.getElementById(tid);
+ }
+ id_list[i] = tid;
+ if (tr.className) {
+ toHide = 0;
+ }
+ }
+ for (var i = 0; i < count; i++) {
+ tid = id_list[i];
+ if (toHide) {
+ document.getElementById('div_'+tid).style.display = 'none'
+ document.getElementById(tid).className = 'hiddenRow';
+ }
+ else {
+ document.getElementById(tid).className = '';
+ }
+ }
+}
+
+
+function showTestDetail(div_id){
+ var details_div = document.getElementById(div_id)
+ var displayState = details_div.style.display
+ // alert(displayState)
+ if (displayState != 'block' ) {
+ displayState = 'block'
+ details_div.style.display = 'block'
+ }
+ else {
+ details_div.style.display = 'none'
+ }
+}
+
+
+function html_escape(s) {
+ s = s.replace(/&/g,'&');
+ s = s.replace(/</g,'<');
+ s = s.replace(/>/g,'>');
+ return s;
+}
+
+/* obsoleted by detail in <div>
+function showOutput(id, name) {
+ var w = window.open("", //url
+ name,
+ "resizable,scrollbars,status,width=800,height=450");
+ d = w.document;
+ d.write("<pre>");
+ d.write(html_escape(output_list[id]));
+ d.write("\n");
+ d.write("<a href='javascript:window.close()'>close</a>\n");
+ d.write("</pre>\n");
+ d.close();
+}
+*/
+--></script>
+
+%(heading)s
+%(report)s
+%(ending)s
+
+</body>
+</html>
+"""
+ # variables: (title, generator, stylesheet, heading, report, ending)
+
+
+ # ------------------------------------------------------------------------
+ # Stylesheet
+ #
+ # alternatively use a <link> for external style sheet, e.g.
+ # <link rel="stylesheet" href="$url" type="text/css">
+
+ STYLESHEET_TMPL = """
+<style type="text/css" media="screen">
+body { font-family: verdana, arial, helvetica, sans-serif; font-size: 80%; }
+table { font-size: 100%; }
+pre { }
+
+/* -- heading ---------------------------------------------------------------------- */
+h1 {
+ font-size: 16pt;
+ color: gray;
+}
+.heading {
+ margin-top: 0ex;
+ margin-bottom: 1ex;
+}
+
+.heading .attribute {
+ margin-top: 1ex;
+ margin-bottom: 0;
+}
+
+.heading .description {
+ margin-top: 4ex;
+ margin-bottom: 6ex;
+}
+
+/* -- css div popup ------------------------------------------------------------------------ */
+a.popup_link {
+}
+
+a.popup_link:hover {
+ color: red;
+}
+
+.popup_window {
+ display: none;
+ position: relative;
+ left: 0px;
+ top: 0px;
+ /*border: solid #627173 1px; */
+ padding: 10px;
+ background-color: #E6E6D6;
+ font-family: "Lucida Console", "Courier New", Courier, monospace;
+ text-align: left;
+ font-size: 8pt;
+ width: 500px;
+}
+
+}
+/* -- report ------------------------------------------------------------------------ */
+#show_detail_line {
+ margin-top: 3ex;
+ margin-bottom: 1ex;
+}
+#result_table {
+ width: 80%;
+ border-collapse: collapse;
+ border: 1px solid #777;
+}
+#header_row {
+ font-weight: bold;
+ color: white;
+ background-color: #777;
+}
+#result_table td {
+ border: 1px solid #777;
+ padding: 2px;
+}
+#total_row { font-weight: bold; }
+.passClass { background-color: #6c6; }
+.failClass { background-color: #c60; }
+.errorClass { background-color: #c00; }
+.passCase { color: #6c6; }
+.failCase { color: #c60; font-weight: bold; }
+.errorCase { color: #c00; font-weight: bold; }
+.hiddenRow { display: none; }
+.testcase { margin-left: 2em; }
+
+
+/* -- ending ---------------------------------------------------------------------- */
+#ending {
+}
+
+</style>
+"""
+
+
+
+ # ------------------------------------------------------------------------
+ # Heading
+ #
+
+ HEADING_TMPL = """<div class='heading'>
+<h1>%(title)s</h1>
+%(parameters)s
+<p class='description'>%(description)s</p>
+</div>
+
+""" # variables: (title, parameters, description)
+
+ HEADING_ATTRIBUTE_TMPL = """<p class='attribute'><strong>%(name)s:</strong> %(value)s</p>
+""" # variables: (name, value)
+
+
+
+ # ------------------------------------------------------------------------
+ # Report
+ #
+
+ REPORT_TMPL = """
+<p id='show_detail_line'>Show
+<a href='javascript:showCase(0)'>Summary</a>
+<a href='javascript:showCase(1)'>Failed</a>
+<a href='javascript:showCase(2)'>All</a>
+</p>
+<table id='result_table'>
+<colgroup>
+<col align='left' />
+<col align='right' />
+<col align='right' />
+<col align='right' />
+<col align='right' />
+<col align='right' />
+</colgroup>
+<tr id='header_row'>
+ <td>Test Group/Test case</td>
+ <td>Count</td>
+ <td>Pass</td>
+ <td>Fail</td>
+ <td>Error</td>
+ <td>View</td>
+</tr>
+%(test_list)s
+<tr id='total_row'>
+ <td>Total</td>
+ <td>%(count)s</td>
+ <td>%(Pass)s</td>
+ <td>%(fail)s</td>
+ <td>%(error)s</td>
+ <td> </td>
+</tr>
+</table>
+""" # variables: (test_list, count, Pass, fail, error)
+
+ REPORT_CLASS_TMPL = r"""
+<tr class='%(style)s'>
+ <td>%(desc)s</td>
+ <td>%(count)s</td>
+ <td>%(Pass)s</td>
+ <td>%(fail)s</td>
+ <td>%(error)s</td>
+ <td><a href="javascript:showClassDetail('%(cid)s',%(count)s)">Detail</a></td>
+</tr>
+""" # variables: (style, desc, count, Pass, fail, error, cid)
+
+
+ REPORT_TEST_WITH_OUTPUT_TMPL = r"""
+<tr id='%(tid)s' class='%(Class)s'>
+ <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
+ <td colspan='5' align='center'>
+
+ <!--css div popup start-->
+ <a class="popup_link" onfocus='this.blur();' href="javascript:showTestDetail('div_%(tid)s')" >
+ %(status)s</a>
+
+ <div id='div_%(tid)s' class="popup_window">
+ <div style='text-align: right; color:red;cursor:pointer'>
+ <a onfocus='this.blur();' onclick="document.getElementById('div_%(tid)s').style.display = 'none' " >
+ [x]</a>
+ </div>
+ <pre>
+ %(script)s
+ </pre>
+ </div>
+ <!--css div popup end-->
+
+ </td>
+</tr>
+""" # variables: (tid, Class, style, desc, status)
+
+
+ REPORT_TEST_NO_OUTPUT_TMPL = r"""
+<tr id='%(tid)s' class='%(Class)s'>
+ <td class='%(style)s'><div class='testcase'>%(desc)s</div></td>
+ <td colspan='5' align='center'>%(status)s</td>
+</tr>
+""" # variables: (tid, Class, style, desc, status)
+
+
+ REPORT_TEST_OUTPUT_TMPL = r"""
+%(id)s: %(output)s
+""" # variables: (id, output)
+
+
+
+ # ------------------------------------------------------------------------
+ # ENDING
+ #
+
+ ENDING_TMPL = """<div id='ending'> </div>"""
+
+# -------------------- The end of the Template class -------------------
+
+
+TestResult = unittest.TestResult
+
+class _TestResult(TestResult):
+ # note: _TestResult is a pure representation of results.
+ # It lacks the output and reporting ability compares to unittest._TextTestResult.
+
+ def __init__(self, verbosity=1):
+ TestResult.__init__(self)
+ self.stdout0 = None
+ self.stderr0 = None
+ self.success_count = 0
+ self.failure_count = 0
+ self.error_count = 0
+ self.verbosity = verbosity
+
+ # result is a list of result in 4 tuple
+ # (
+ # result code (0: success; 1: fail; 2: error),
+ # TestCase object,
+ # Test output (byte string),
+ # stack trace,
+ # )
+ self.result = []
+
+
+ def startTest(self, test):
+ TestResult.startTest(self, test)
+ # just one buffer for both stdout and stderr
+ self.outputBuffer = StringIO.StringIO()
+ stdout_redirector.fp = self.outputBuffer
+ stderr_redirector.fp = self.outputBuffer
+ self.stdout0 = sys.stdout
+ self.stderr0 = sys.stderr
+ sys.stdout = stdout_redirector
+ sys.stderr = stderr_redirector
+
+
+ def complete_output(self):
+ """
+ Disconnect output redirection and return buffer.
+ Safe to call multiple times.
+ """
+ if self.stdout0:
+ sys.stdout = self.stdout0
+ sys.stderr = self.stderr0
+ self.stdout0 = None
+ self.stderr0 = None
+ return self.outputBuffer.getvalue()
+
+
+ def stopTest(self, test):
+ # Usually one of addSuccess, addError or addFailure would have been called.
+ # But there are some path in unittest that would bypass this.
+ # We must disconnect stdout in stopTest(), which is guaranteed to be called.
+ self.complete_output()
+
+
+ def addSuccess(self, test):
+ self.success_count += 1
+ TestResult.addSuccess(self, test)
+ output = self.complete_output()
+ self.result.append((0, test, output, ''))
+ if self.verbosity > 1:
+ sys.stderr.write('ok ')
+ sys.stderr.write(str(test))
+ sys.stderr.write('\n')
+ else:
+ sys.stderr.write('.')
+
+ def addError(self, test, err):
+ self.error_count += 1
+ TestResult.addError(self, test, err)
+ _, _exc_str = self.errors[-1]
+ output = self.complete_output()
+ self.result.append((2, test, output, _exc_str))
+ if self.verbosity > 1:
+ sys.stderr.write('E ')
+ sys.stderr.write(str(test))
+ sys.stderr.write('\n')
+ else:
+ sys.stderr.write('E')
+
+ def addFailure(self, test, err):
+ self.failure_count += 1
+ TestResult.addFailure(self, test, err)
+ _, _exc_str = self.failures[-1]
+ output = self.complete_output()
+ self.result.append((1, test, output, _exc_str))
+ if self.verbosity > 1:
+ sys.stderr.write('F ')
+ sys.stderr.write(str(test))
+ sys.stderr.write('\n')
+ else:
+ sys.stderr.write('F')
+
+
+class HTMLTestRunner(Template_mixin):
+ """
+ """
+ def __init__(self, stream=sys.stdout, verbosity=1, title=None, description=None):
+ self.stream = stream
+ self.verbosity = verbosity
+ if title is None:
+ self.title = self.DEFAULT_TITLE
+ else:
+ self.title = title
+ if description is None:
+ self.description = self.DEFAULT_DESCRIPTION
+ else:
+ self.description = description
+
+ self.startTime = datetime.datetime.now()
+
+
+ def run(self, test):
+ "Run the given test case or test suite."
+ result = _TestResult(self.verbosity)
+ test(result)
+ self.stopTime = datetime.datetime.now()
+ self.generateReport(test, result)
+ print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)
+ return result
+
+
+ def sortResult(self, result_list):
+ # unittest does not seems to run in any particular order.
+ # Here at least we want to group them together by class.
+ rmap = {}
+ classes = []
+ for n,t,o,e in result_list:
+ cls = t.__class__
+ if not rmap.has_key(cls):
+ rmap[cls] = []
+ classes.append(cls)
+ rmap[cls].append((n,t,o,e))
+ r = [(cls, rmap[cls]) for cls in classes]
+ return r
+
+
+ def getReportAttributes(self, result):
+ """
+ Return report attributes as a list of (name, value).
+ Override this to add custom attributes.
+ """
+ startTime = str(self.startTime)[:19]
+ duration = str(self.stopTime - self.startTime)
+ status = []
+ if result.success_count: status.append('Pass %s' % result.success_count)
+ if result.failure_count: status.append('Failure %s' % result.failure_count)
+ if result.error_count: status.append('Error %s' % result.error_count )
+ if status:
+ status = ' '.join(status)
+ else:
+ status = 'none'
+ return [
+ ('Start Time', startTime),
+ ('Duration', duration),
+ ('Status', status),
+ ]
+
+
+ def generateReport(self, test, result):
+ report_attrs = self.getReportAttributes(result)
+ generator = 'HTMLTestRunner %s' % __version__
+ stylesheet = self._generate_stylesheet()
+ heading = self._generate_heading(report_attrs)
+ report = self._generate_report(result)
+ ending = self._generate_ending()
+ output = self.HTML_TMPL % dict(
+ title = saxutils.escape(self.title),
+ generator = generator,
+ stylesheet = stylesheet,
+ heading = heading,
+ report = report,
+ ending = ending,
+ )
+ self.stream.write(output.encode('utf8'))
+
+
+ def _generate_stylesheet(self):
+ return self.STYLESHEET_TMPL
+
+
+ def _generate_heading(self, report_attrs):
+ a_lines = []
+ for name, value in report_attrs:
+ line = self.HEADING_ATTRIBUTE_TMPL % dict(
+ name = saxutils.escape(name),
+ value = saxutils.escape(value),
+ )
+ a_lines.append(line)
+ heading = self.HEADING_TMPL % dict(
+ title = saxutils.escape(self.title),
+ parameters = ''.join(a_lines),
+ description = saxutils.escape(self.description),
+ )
+ return heading
+
+
+ def _generate_report(self, result):
+ rows = []
+ sortedResult = self.sortResult(result.result)
+ for cid, (cls, cls_results) in enumerate(sortedResult):
+ # subtotal for a class
+ np = nf = ne = 0
+ for n,t,o,e in cls_results:
+ if n == 0: np += 1
+ elif n == 1: nf += 1
+ else: ne += 1
+
+ # format class description
+ if cls.__module__ == "__main__":
+ name = cls.__name__
+ else:
+ name = "%s.%s" % (cls.__module__, cls.__name__)
+ doc = cls.__doc__ and cls.__doc__.split("\n")[0] or ""
+ desc = doc and '%s: %s' % (name, doc) or name
+
+ row = self.REPORT_CLASS_TMPL % dict(
+ style = ne > 0 and 'errorClass' or nf > 0 and 'failClass' or 'passClass',
+ desc = desc,
+ count = np+nf+ne,
+ Pass = np,
+ fail = nf,
+ error = ne,
+ cid = 'c%s' % (cid+1),
+ )
+ rows.append(row)
+
+ for tid, (n,t,o,e) in enumerate(cls_results):
+ self._generate_report_test(rows, cid, tid, n, t, o, e)
+
+ report = self.REPORT_TMPL % dict(
+ test_list = ''.join(rows),
+ count = str(result.success_count+result.failure_count+result.error_count),
+ Pass = str(result.success_count),
+ fail = str(result.failure_count),
+ error = str(result.error_count),
+ )
+ return report
+
+
+ def _generate_report_test(self, rows, cid, tid, n, t, o, e):
+ # e.g. 'pt1.1', 'ft1.1', etc
+ has_output = bool(o or e)
+ tid = (n == 0 and 'p' or 'f') + 't%s.%s' % (cid+1,tid+1)
+ name = t.id().split('.')[-1]
+ doc = t.shortDescription() or ""
+ desc = doc and ('%s: %s' % (name, doc)) or name
+ tmpl = has_output and self.REPORT_TEST_WITH_OUTPUT_TMPL or self.REPORT_TEST_NO_OUTPUT_TMPL
+
+ # o and e should be byte string because they are collected from stdout and stderr?
+ if isinstance(o,str):
+ # TODO: some problem with 'string_escape': it escape \n and mess up formating
+ # uo = unicode(o.encode('string_escape'))
+ uo = o.decode('latin-1')
+ else:
+ uo = o
+ if isinstance(e,str):
+ # TODO: some problem with 'string_escape': it escape \n and mess up formating
+ # ue = unicode(e.encode('string_escape'))
+ ue = e.decode('latin-1')
+ else:
+ ue = e
+
+ script = self.REPORT_TEST_OUTPUT_TMPL % dict(
+ id = tid,
+ output = saxutils.escape(uo+ue),
+ )
+
+ row = tmpl % dict(
+ tid = tid,
+ Class = (n == 0 and 'hiddenRow' or 'none'),
+ style = n == 2 and 'errorCase' or (n == 1 and 'failCase' or 'none'),
+ desc = desc,
+ script = script,
+ status = self.STATUS[n],
+ )
+ rows.append(row)
+ if not has_output:
+ return
+
+ def _generate_ending(self):
+ return self.ENDING_TMPL
+
+
+##############################################################################
+# Facilities for running tests from the command line
+##############################################################################
+
+# Note: Reuse unittest.TestProgram to launch test. In the future we may
+# build our own launcher to support more specific command line
+# parameters like test title, CSS, etc.
+class TestProgram(unittest.TestProgram):
+ """
+ A variation of the unittest.TestProgram. Please refer to the base
+ class for command line parameters.
+ """
+ def runTests(self):
+ # Pick HTMLTestRunner as the default test runner.
+ # base class's testRunner parameter is not useful because it means
+ # we have to instantiate HTMLTestRunner before we know self.verbosity.
+ if self.testRunner is None:
+ self.testRunner = HTMLTestRunner(verbosity=self.verbosity)
+ unittest.TestProgram.runTests(self)
+
+main = TestProgram
+
+##############################################################################
+# Executing this module from the command line
+##############################################################################
+
+if __name__ == "__main__":
+ main(module=None)
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+# Copyright (C) 2010-2012 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import tempfile
+import sys
+import subprocess
+import time
+
+class outRedirection():
+ '''redirection of standart output
+ useful for testing the terminal display
+ '''
+ def __init__(self):
+ '''initialization
+ '''
+ self._fstream = tempfile.NamedTemporaryFile(mode='w')
+ self.saveout = sys.stdout
+ sys.stdout = self._fstream
+
+ def flush(self):
+ self._fstream.flush()
+
+ def end_redirection(self):
+ self._fstream.seek(0)
+ ff = open(self._fstream.name, 'r')
+ self.res = ff.read()
+ self._fstream.close()
+ sys.stdout = self.saveout
+
+ def read_results(self):
+ try:
+ return self.res
+ except Exception as exc:
+ print('Problem with redirection : %s' % exc)
+ sys.exit(1)
+
+def kill9(pid):
+ subprocess.call("kill -9 " + pid, shell=True)
+
+def check_proc_existence_and_kill(regex):
+ cmd = 'ps aux | grep "' + regex + '"'
+ psRes = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).communicate()[0]
+ psRes = psRes.split('\n')
+ for line in psRes:
+ if 'grep' in line or len(line) == 0:
+ continue
+ line2 = [i for i in line.split(' ') if i != '']
+ pid = line2[1]
+ kill9(pid)
+ return pid
+ return 0
+
+def check_proc_existence_and_kill_multi(regex, nb_kills, time_between_two_checks = 1):
+ found = False
+ i = 0
+ while not found and i < nb_kills :
+ found = check_proc_existence_and_kill(regex)
+ if found:
+ return found
+ time.sleep(time_between_two_checks)
+ i+=1
+ return 0
\ No newline at end of file