Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bionetgen/modelapi/bngfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ def generate_xml(self, xml_file, model_file=None) -> bool:
xml_file, stripped_bngl
) # no need to chdir here, handled by finally block

app_stdout = conf.get("stdout")
app_suppress = False if app_stdout == "STDOUT" else self.suppress
rc, _ = run_command(
["perl", self.bngexec, "--xml", stripped_bngl],
suppress=app_suppress,
suppress=self.suppress,
cwd=temp_folder,
)
if rc != 0:
Expand Down
12 changes: 8 additions & 4 deletions tests/test_csimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,10 @@ def test_csimulator_init_str():
with unittest.mock.patch(
"bionetgen.simulator.csimulator._new_ccompiler"
) as mock_new_comp:
with unittest.mock.patch("bionetgen.simulator.csimulator.conf") as mock_conf:
mock_conf.get.return_value = "dummy"
with unittest.mock.patch(
"bionetgen.simulator.csimulator.get_conf"
) as mock_conf:
mock_conf.return_value = {"cvode_include": "dummy", "cvode_lib": "dummy"}

with unittest.mock.patch(
"bionetgen.simulator.csimulator.bionetgen.run"
Expand Down Expand Up @@ -222,8 +224,10 @@ def test_csimulator_init_bngmodel():
with unittest.mock.patch(
"bionetgen.simulator.csimulator._new_ccompiler"
) as mock_new_comp:
with unittest.mock.patch("bionetgen.simulator.csimulator.conf") as mock_conf:
mock_conf.get.return_value = "dummy"
with unittest.mock.patch(
"bionetgen.simulator.csimulator.get_conf"
) as mock_conf:
mock_conf.return_value = {"cvode_include": "dummy", "cvode_lib": "dummy"}

with unittest.mock.patch(
"bionetgen.simulator.csimulator.bionetgen.run"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_modelapi_export_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ def test_bngmodel_passes_path_options_to_bngparser(mock_parser_cls):
from bionetgen.modelapi.model import bngmodel

parser = MagicMock()

def _fake_parse_model(model):
for b in model._block_order:
if b not in model.active_blocks:
model.active_blocks.append(b)

parser.parse_model.side_effect = _fake_parse_model
mock_parser_cls.return_value = parser

bngmodel(
Expand All @@ -240,6 +247,7 @@ def test_bngmodel_passes_path_options_to_bngparser(mock_parser_cls):
BNGPATH="/custom/bng",
generate_network=True,
suppress=False,
verbose=False,
)
parser.parse_model.assert_called_once()

Expand Down
Loading