Commit dc27928d authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib][tests] Hardening tests by using the error attr of the reporter

parent fe28f3c0
......@@ -51,7 +51,6 @@ Review: Pay attention: Lots of tests are made without any assertion.
from __future__ import print_function
import pkg_resources
import unittest
import sys
import os
import networkx as nx
......@@ -65,10 +64,10 @@ from cadbiom.models.guard_transitions.chart_model import ChartModel
from cadbiom.models.guard_transitions.translators.chart_xml import \
MakeModelFromXmlFile
from cadbiom.commons import DIR_LOGS
from cadbiom.commons import DIR_LOGS, logger
TRACEFILE = sys.stdout
#TRACEFILE = open("/tmp/testMCLTranslator.txt",'w')
LOGGER = logger()
class Reporter(object):
......@@ -86,7 +85,8 @@ class Reporter(object):
"""
self.error = True
mess = self.mess + "ERROR -> "+mes
TRACEFILE.write("\n\n"+ mess)
LOGGER.error(mess)
class TestAnaVisitors(unittest.TestCase):
"""
......@@ -118,6 +118,7 @@ class TestAnaVisitors(unittest.TestCase):
scc.append(elem)
print('SCC FRONTIER ', scc) # empty list ?
assert scc == []
assert reporter.error == False
class TestStaticAnalysis(unittest.TestCase):
......@@ -152,6 +153,7 @@ class TestStaticAnalysis(unittest.TestCase):
lvi = LangVisitor(out)
parser.model.accept(lvi)
out.close()
assert reporter.error == False
def test_frontier1_no_clock(self):
"""
......@@ -182,7 +184,7 @@ class TestStaticAnalysis(unittest.TestCase):
lvi = LangVisitor(out)
parser.model.accept(lvi)
out.close()
assert reporter.error == False
def test_frontier2(self):
"""
......@@ -204,6 +206,7 @@ class TestStaticAnalysis(unittest.TestCase):
ftr = sta.get_frontier_scc()
print(ftr)
assert [set(['betaglycan__dimer___intToMb', 'TGFB_TGFBR2_betaglycan_active_intToMb'])] == ftr
assert reporter.error == False
def test_get_tr_node_variables(self):
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment