Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VIGNET Pierre
cadbiom
Commits
dc27928d
Commit
dc27928d
authored
Feb 22, 2020
by
VIGNET Pierre
Browse files
[lib][tests] Hardening tests by using the error attr of the reporter
parent
fe28f3c0
Changes
1
Show whitespace changes
Inline
Side-by-side
library/cadbiom/models/guard_transitions/analyser/TestStaticAnalysis.py
View file @
dc27928d
...
...
@@ -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
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment