예제 #1
0
    def setUp(self):
        (self.fd, self.logfn) = tempfile.mkstemp()
        self.handle = os.fdopen(self.fd)

        # set the test log format
        fancylogger.setTestLogFormat()

        # make new logger
        fancylogger.logToFile(self.logfn)

        # disable default ones (with default format)
        fancylogger.disableDefaultHandlers()
예제 #2
0
def make_worker_log(name,
                    debug=False,
                    logfn_name=None,
                    disable_defaulthandlers=False):
    """Make a basic log object"""
    if logfn_name is None:
        logfn_name = name
    logfn = '/tmp/scoop_%s.log' % logfn_name

    if debug:
        setLogLevelDebug()

    logToFile(logfn, name=name)
    os.chmod(logfn, stat.S_IRUSR | stat.S_IWUSR)

    if disable_defaulthandlers:
        disableDefaultHandlers()

    _log = getLogger(name=name)

    return _log
예제 #3
0
@author: Toon Willems (Ghent University)
@author: Kenneth Hoste (Ghent University)
"""
import glob
import os
import shutil
import sys
import tempfile
import unittest
from vsc import fancylogger

import easybuild.tools.build_log  # initialize EasyBuild logging, so we disable it
import test.easyconfigs.easyconfigs as e

# disable all logging to significantly speed up tests
fancylogger.disableDefaultHandlers()
fancylogger.setLogLevelError()

os.environ['EASYBUILD_TMP_LOGDIR'] = tempfile.mkdtemp(
    prefix='easyconfigs_test_')

# call suite() for each module and then run them all
SUITE = unittest.TestSuite([x.suite() for x in [e]])

# uses XMLTestRunner if possible, so we can output an XML file that can be supplied to Jenkins
xml_msg = ""
try:
    import xmlrunner  # requires unittest-xml-reporting package
    xml_dir = 'test-reports'
    res = xmlrunner.XMLTestRunner(output=xml_dir, verbosity=1).run(SUITE)
    xml_msg = ", XML output of tests available in %s directory" % xml_dir
예제 #4
0
@author: Toon Willems (Ghent University)
@author: Kenneth Hoste (Ghent University)
"""
import glob
import os
import shutil
import sys
import tempfile
import unittest
from vsc import fancylogger

import easybuild.tools.build_log  # initialize EasyBuild logging, so we disable it
import test.easyconfigs.easyconfigs as e

# disable all logging to significantly speed up tests
fancylogger.disableDefaultHandlers()
fancylogger.setLogLevelError()

os.environ['EASYBUILD_TMP_LOGDIR'] = tempfile.mkdtemp(prefix='easyconfigs_test_')

# call suite() for each module and then run them all
SUITE = unittest.TestSuite([x.suite() for x in [e]])

# uses XMLTestRunner if possible, so we can output an XML file that can be supplied to Jenkins
xml_msg = ""
try:
    import xmlrunner  # requires unittest-xml-reporting package
    xml_dir = 'test-reports'
    res = xmlrunner.XMLTestRunner(output=xml_dir, verbosity=1).run(SUITE)
    xml_msg = ", XML output of tests available in %s directory" % xml_dir
except ImportError, err: