Skip to content

Commit

Permalink
quench info msgs when running unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangWaltenberger committed Apr 11, 2024
1 parent e2c1b18 commit ea3cf34
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
7 changes: 5 additions & 2 deletions unittests/runCompleteTestSuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ def verbose_run( filter=None, testNotebooks=False, reduced=False ):
alltests._tests = [t for t in alltests._tests[:] if isInReducedSet(t) ]

n_tests, n_failed = 0, 0
n_test = 0
for series in alltests:
for test in series:
if type(test)!=unittest.suite.TestSuite:
print ( "%sError: could not import ``%s'' {%s}" % \
( colors.error, test, type(test) ) )
print ( f"{colors.error}Error: could not import ``{test}'' {type(test)}" )
print ( test._exception, colors.reset )
continue
for t in test:
n_test += 1
# if n_test < 190: # we can speed things up here
# continue
if filter and (not filter in str(t)):
continue
n_tests += 1
Expand Down
5 changes: 4 additions & 1 deletion unittests/testTheoryPredCombinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

from smodels.statistics.simplifiedLikelihoods import LikelihoodComputer
LikelihoodComputer.debug_mode = True
from smodels.matching.theoryPrediction import theoryPredictionsFor,TheoryPredictionsCombiner
from smodels.matching.theoryPrediction import theoryPredictionsFor, \
TheoryPredictionsCombiner
from smodels.base.smodelsLogging import setLogLevel
from smodels.decomposition import decomposer
from smodels.base.model import Model
from smodels.share.models.SMparticles import SMList
Expand Down Expand Up @@ -194,6 +196,7 @@ def testFilter(self):


def testGetCombiner(self):
setLogLevel ( "fatal" )

slhafile = "./testFiles/slha/gluino_squarks.slha"
parfile = "./testParameters_comb.ini"
Expand Down
17 changes: 9 additions & 8 deletions unittests/testXSecComputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from smodels.tools import xsecComputer, toolBox
from smodels.tools.xsecComputer import LO, NLL
from smodels.base.physicsUnits import TeV, fb
from smodels.base.smodelsLogging import setLogLevel, logger
from smodels.base import crossSection
import tempfile
import unittest
Expand All @@ -24,15 +25,14 @@
class XSecTest(unittest.TestCase):
# use different logging config for the unit tests.
logging.config.fileConfig( "./logging.conf" )
from smodels.base.smodelsLogging import setLogLevel,logger

setLogLevel ( "warn" )

toolBox.ToolBox().compile() ## make sure the tools are compiled

def testLOGlu(self):
""" test the computation of LO cross section, pythia6 """
self.logger.info ( "test LO xsecs @ 8 TeV" )
logger.info ( "test LO xsecs @ 8 TeV" )
slhafile= "./testFiles/slha/simplyGluino.slha"
computer = xsecComputer.XSecComputer ( LO, 2000, 6 )
w = computer.compute(8*TeV, slhafile ).getDictionary()
Expand All @@ -42,7 +42,7 @@ def testLOGlu(self):

def testNLLGlu(self):
""" test the computation of NLL cross section """
self.logger.info ( "test NLL xsecs @ 8 TeV" )
logger.info ( "test NLL xsecs @ 8 TeV" )
slhafile="./testFiles/slha/simplyGluino.slha"
computer = xsecComputer.XSecComputer ( NLL, 2000, 6 )
w = computer.compute( 8*TeV, slhafile ).getDictionary()
Expand All @@ -51,7 +51,7 @@ def testNLLGlu(self):

def testLOGlu13(self):
""" test the computation of LO cross section, pythia6 """
self.logger.info ( "test LO xsecs @ 13 TeV" )
logger.info ( "test LO xsecs @ 13 TeV" )
slhafile="./testFiles/slha/simplyGluino.slha"
computer = xsecComputer.XSecComputer ( LO, 3000, 6 )
w = computer.compute( 13*TeV, slhafile ).getDictionary()
Expand All @@ -60,7 +60,7 @@ def testLOGlu13(self):

def testNLLGlu13(self):
""" test the computation of NLL cross section with pythia6 """
self.logger.info ( "test NLL xsecs @ 13 TeV" )
logger.info ( "test NLL xsecs @ 13 TeV" )
slhafile="./testFiles/slha/simplyGluino.slha"
computer = xsecComputer.XSecComputer ( NLL, 3000, 6 )
w = computer.compute( 13*TeV, slhafile ).getDictionary()
Expand All @@ -81,7 +81,7 @@ def testXSecMain(self):
fnew = open(tmpfile,'w')
fnew.write(fdata)
fnew.close()
self.logger.info ("test NLL xsecs @ 8 and 13 TeV" )
logger.info ("test NLL xsecs @ 8 and 13 TeV" )
#Set overall options:
#Options for cross section calculation:
xargs = argparse.Namespace()
Expand Down Expand Up @@ -137,7 +137,7 @@ def testSSMultipliers(self):
fnew = open(tmpfile,'w')
fnew.write(fdata)
fnew.close()
self.logger.info ("test NLL xsecs @ 8 and 13 TeV" )
logger.info ("test NLL xsecs @ 8 and 13 TeV" )
#Set overall options:
#Options for cross section calculation:
xargs = argparse.Namespace()
Expand Down Expand Up @@ -182,6 +182,7 @@ def testSSMultipliers(self):

def testSSJokers(self):
""" test the signal strength multipliers, with jokers """
setLogLevel ( "fatal" )

slhafile="./testFiles/slha/simplyGluino.slha"
f = open(slhafile,'r')
Expand All @@ -194,7 +195,7 @@ def testSSJokers(self):
fnew = open(tmpfile,'w')
fnew.write(fdata)
fnew.close()
self.logger.info ("test NLL xsecs @ 8 and 13 TeV" )
logger.info ("test NLL xsecs @ 8 and 13 TeV" )
#Set overall options:
#Options for cross section calculation:
xargs = argparse.Namespace()
Expand Down

0 comments on commit ea3cf34

Please sign in to comment.