summaryrefslogtreecommitdiff
path: root/src/integration-tests/gnunet_testing.py.in
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-02-16 17:32:44 +0000
committerng0 <ng0@n0.is>2019-02-16 17:32:44 +0000
commit795f98a989cc349cc9e60c330eaf02bf69cb936b (patch)
tree37909026d5ec743f198af671c12b964f6e16488b /src/integration-tests/gnunet_testing.py.in
parent743ea291bd4cf84ee78adfc1fe0e35cedcff41a9 (diff)
gnunet_testing.py.in: first set of logging
Diffstat (limited to 'src/integration-tests/gnunet_testing.py.in')
-rw-r--r--src/integration-tests/gnunet_testing.py.in42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/integration-tests/gnunet_testing.py.in b/src/integration-tests/gnunet_testing.py.in
index 1470c3d38..cbc3e5a45 100644
--- a/src/integration-tests/gnunet_testing.py.in
+++ b/src/integration-tests/gnunet_testing.py.in
@@ -28,7 +28,15 @@ import sys
import shutil
import time
from gnunet_pyexpect import pexpect
+import logging
+logger = logging.getLogger()
+handler = logging.StreamHandler()
+formatter = logging.Formatter(
+ '%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
+handler.setFormatter(formatter)
+logger.addHandler(handler)
+logger.setLevel(logging.DEBUG)
class Check(object):
def __init__(self, test):
@@ -59,7 +67,8 @@ class Check(object):
time.sleep(1)
execs += 1
if ((False == res) and (execs >= timeout)):
- print(('Check had timeout after ' + str(timeout) + ' seconds'))
+ logger.debug('Check had timeout after %s seconds', str(timeout))
+ # print(('Check had timeout after ' + str(timeout) + ' seconds'))
neg_cont(self)
elif ((False == res) and (execs < timeout)):
if (None != neg_cont):
@@ -87,7 +96,8 @@ class Check(object):
neg += 1
else:
pos += 1
- print((str(pos) + ' out of ' + str(pos+neg) + ' conditions fulfilled'))
+ # print((str(pos) + ' out of ' + str(pos+neg) + ' conditions fulfilled'))
+ logger.debug('%s out of %s conditions fulfilled', str(pos), str(pos+neg))
return self.fulfilled
def reset(self):
@@ -110,9 +120,11 @@ class Condition(object):
def evaluate(self, failed_only):
if ((self.fulfilled == False) and (failed_only == True)):
- print(str(self.type) + 'condition for was ' + str(self.fulfilled))
+ # print(str(self.type) + 'condition for was ' + str(self.fulfilled))
+ logger.debug('%s condition for was %s', str(self.type), str(self.fulfilled))
elif (failed_only == False):
- print(str(self.type) + 'condition for was ' + str(self.fulfilled))
+ # print(str(self.type) + 'condition for was ' + str(self.fulfilled))
+ logger.debug('%s condition for was %s', str(self.type), str(self.fulfilled))
return self.fulfilled
@@ -135,17 +147,19 @@ class FileExistCondition(Condition):
def evaluate(self, failed_only):
if ((self.fulfilled == False) and (failed_only == True)):
- print(str(self.type) +
- 'condition for file ' +
- self.file +
- ' was ' +
- str(self.fulfilled))
+ # print(str(self.type) +
+ # 'condition for file ' +
+ # self.file +
+ # ' was ' +
+ # str(self.fulfilled))
+ logger.debug('%s confition for file %s was %s', str(self.type), self.file, str(self.fulfilled))
elif (failed_only == False):
- print(str(self.type) +
- 'condition for file ' +
- self.file +
- ' was ' +
- str(self.fulfilled))
+ # print(str(self.type) +
+ # 'condition for file ' +
+ # self.file +
+ # ' was ' +
+ # str(self.fulfilled))
+ logger.debug('%s confition for file %s was %s', str(self.type), self.file, str(self.fulfilled))
return self.fulfilled