Added traceback for identify the testcases name and removed print functions
This commit is contained in:
parent
45bf53f376
commit
671b42bdab
|
@ -23,7 +23,6 @@ import traceback
|
||||||
from struct import pack
|
from struct import pack
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print('222222222222222trybitmessagemain testing for the bitmessgemain')
|
|
||||||
import defaults
|
import defaults
|
||||||
import depends
|
import depends
|
||||||
import shared
|
import shared
|
||||||
|
@ -50,7 +49,6 @@ try:
|
||||||
from helper_test import TestCoreDummy
|
from helper_test import TestCoreDummy
|
||||||
|
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print('333333333333block except bitmessagemain testing for the bitmessgemain')
|
|
||||||
from pybitmessage import defaults
|
from pybitmessage import defaults
|
||||||
from pybitmessage import depends
|
from pybitmessage import depends
|
||||||
from pybitmessage import shared
|
from pybitmessage import shared
|
||||||
|
@ -77,7 +75,6 @@ except ModuleNotFoundError:
|
||||||
addressGenerator, objectProcessor, singleCleaner,
|
addressGenerator, objectProcessor, singleCleaner,
|
||||||
singleWorker, sqlThread)
|
singleWorker, sqlThread)
|
||||||
from pybitmessage.helper_test import TestCoreDummy
|
from pybitmessage.helper_test import TestCoreDummy
|
||||||
print('44444444444444444444444444444444444')
|
|
||||||
|
|
||||||
app_dir = os.path.dirname(os.path.abspath(__file__))
|
app_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
os.chdir(app_dir)
|
os.chdir(app_dir)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import subprocess # nosec
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
import traceback
|
||||||
try:
|
try:
|
||||||
import psutil
|
import psutil
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
@ -44,7 +44,8 @@ class TestProcessProto(unittest.TestCase):
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
cls.pid = int(cls._get_readline('singleton.lock'))
|
cls.pid = int(cls._get_readline('singleton.lock'))
|
||||||
cls.process = psutil.Process(cls.pid)
|
cls.process = psutil.Process(cls.pid)
|
||||||
print('')
|
print('traceback in setupClass')
|
||||||
|
print(traceback.format_stack())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_readline(cls, pfile):
|
def _get_readline(cls, pfile):
|
||||||
|
@ -59,17 +60,13 @@ class TestProcessProto(unittest.TestCase):
|
||||||
def _stop_process(cls, timeout=120):
|
def _stop_process(cls, timeout=120):
|
||||||
cls.process.send_signal(signal.SIGTERM)
|
cls.process.send_signal(signal.SIGTERM)
|
||||||
try:
|
try:
|
||||||
print('1111111111111111111111111111111111111111')
|
|
||||||
print('In the _stop_process_ method ,after the term signal wait process are started')
|
print('In the _stop_process_ method ,after the term signal wait process are started')
|
||||||
print('1111111111111111111111111111111111111111')
|
|
||||||
cls.process.wait(timeout)
|
cls.process.wait(timeout)
|
||||||
print('222222222222222222222222222222222222')
|
|
||||||
print('In the _stop_process_ method ,wait process are completed')
|
print('In the _stop_process_ method ,wait process are completed')
|
||||||
print('222222222222222222222222222222222222')
|
|
||||||
except psutil.TimeoutExpired:
|
except psutil.TimeoutExpired:
|
||||||
print('33333333333333333333333333333333')
|
print('traceback in _stop_process')
|
||||||
|
print(traceback.format_stack())
|
||||||
print('In the _stop_process_ method ,psutil.timoutExpired is occured')
|
print('In the _stop_process_ method ,psutil.timoutExpired is occured')
|
||||||
print('33333333333333333333333333333333')
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -87,27 +84,20 @@ class TestProcessProto(unittest.TestCase):
|
||||||
"""Ensures that pybitmessage stopped and removes files"""
|
"""Ensures that pybitmessage stopped and removes files"""
|
||||||
try:
|
try:
|
||||||
if not cls._stop_process():
|
if not cls._stop_process():
|
||||||
print('444444444444444444444444444444')
|
|
||||||
print('In the tearDownClass ,initiating the process Killing')
|
print('In the tearDownClass ,initiating the process Killing')
|
||||||
print('44444444444444444444444444444')
|
|
||||||
cls.process.kill()
|
cls.process.kill()
|
||||||
print('5555555555555555555555555555555')
|
|
||||||
print('In the tearDownClass ,initiating the process wait')
|
print('In the tearDownClass ,initiating the process wait')
|
||||||
print('55555555555555555555555555555')
|
|
||||||
cls.process.wait(5)
|
cls.process.wait(5)
|
||||||
print('6666666666666666666666666666')
|
|
||||||
print('In the tearDownClass ,Process killied ?')
|
print('In the tearDownClass ,Process killied ?')
|
||||||
print('666666666666666666666666666666')
|
|
||||||
except (psutil.NoSuchProcess, FileNotFoundError, AttributeError) as e:
|
except (psutil.NoSuchProcess, FileNotFoundError, AttributeError) as e:
|
||||||
print('77777777777777777777777777')
|
|
||||||
print('In the tearDownClass ,psutil.NoSuchProcess,FileNotFoundError, AttributeError')
|
print('In the tearDownClass ,psutil.NoSuchProcess,FileNotFoundError, AttributeError')
|
||||||
|
print('traceback in tearDownClass')
|
||||||
|
traceback.format_stack()
|
||||||
print(str(e))
|
print(str(e))
|
||||||
print('77777777777777777777777777')
|
|
||||||
except psutil.TimeoutExpired as e:
|
except psutil.TimeoutExpired as e:
|
||||||
print('88888888888888888888888')
|
|
||||||
print('In the tearDownClass ,psutil.TimeoutExpired is occurred')
|
print('In the tearDownClass ,psutil.TimeoutExpired is occurred')
|
||||||
|
traceback.format_stack()
|
||||||
print(str(e))
|
print(str(e))
|
||||||
print('888888888888888888888888')
|
|
||||||
finally:
|
finally:
|
||||||
cls._cleanup_files()
|
cls._cleanup_files()
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user