Skip to content

Commit

Permalink
🩹Adapted pytest benchmarks to new monkeypatch_plugin_registry
Browse files Browse the repository at this point in the history
🩹Use the new monkeypatch_plugin_registry contextmanager in the pytest benchamrks to setup_model
🐛 Make removal of (optional) key fault tolerant
  • Loading branch information
jsnel committed Sep 15, 2021
1 parent c18f791 commit e057dd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions benchmark/pytest/analysis/test_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from glotaran.model import megacomplex
from glotaran.parameter import ParameterGroup
from glotaran.project import Scheme
from glotaran.testing.plugin_system import monkeypatch_plugin_registry

if TYPE_CHECKING:
from glotaran.model import DatasetModel
Expand Down Expand Up @@ -53,6 +54,7 @@ def finalize_data(
pass


@monkeypatch_plugin_registry(test_megacomplex={"benchmark": BenchmarkMegacomplex})
def setup_model(index_dependent):
model_dict = {
"megacomplex": {"m1": {"is_index_dependent": index_dependent}},
Expand Down
2 changes: 1 addition & 1 deletion glotaran/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def from_dict(
}
if default_megacomplex_type is not None:
megacomplex_types[default_megacomplex_type] = get_megacomplex(default_megacomplex_type)
del model_dict["default-megacomplex"]
model_dict.pop("default-megacomplex", None)

model = cls(
megacomplex_types=megacomplex_types, default_megacomplex_type=default_megacomplex_type
Expand Down

0 comments on commit e057dd9

Please sign in to comment.