Skip to content

Commit

Permalink
Merge pull request #681 from opencobra/feat-solver-logging
Browse files Browse the repository at this point in the history
feat: enable solver output on debug logging
  • Loading branch information
Midnighter committed Feb 4, 2020
2 parents 24443a1 + 8c5757e commit b78de4c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ History

Next Release
------------
* Setting the log level to DEBUG now also enables the solver log output.

0.9.13 (2019-12-04)
-------------------
Expand Down
4 changes: 4 additions & 0 deletions src/memote/suite/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def test_model(model, sbml_version=None, results=False, pytest_args=None,
pytest_args.extend(["--tb", "short"])
if TEST_DIRECTORY not in pytest_args:
pytest_args.append(TEST_DIRECTORY)
if "-s" not in pytest_args and LOGGER.getEffectiveLevel() <= logging.DEBUG:
# Disable pytest capturing so that the solver log output can be seen
# immediately.
pytest_args.insert(0, "-s")
plugin = ResultCollectionPlugin(model, sbml_version=sbml_version,
exclusive=exclusive, skip=skip,
experimental_config=experimental)
Expand Down
2 changes: 2 additions & 0 deletions src/memote/suite/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def __init__(self, model, sbml_version=None, experimental_config=None,
self.results.add_environment_information(self.results.meta)
self._xcld = frozenset() if exclusive is None else frozenset(exclusive)
self._skip = frozenset() if skip is None else frozenset(skip)
if LOGGER.getEffectiveLevel() <= logging.DEBUG:
self._model.solver.configuration.verbosity = 3

def pytest_generate_tests(self, metafunc):
"""Parametrize marked functions at runtime."""
Expand Down

0 comments on commit b78de4c

Please sign in to comment.