Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasha10 committed Jan 11, 2022
1 parent 0a042fb commit f2d2c2c
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/test_hydra_context_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from unittest.mock import Mock

from omegaconf import DictConfig, OmegaConf
from pytest import mark, warns
from pytest import mark, raises, warns

from hydra import TaskFunction
from hydra._internal.callbacks import Callbacks
Expand Down Expand Up @@ -73,19 +73,14 @@ def test_setup_plugins(
monkeypatch.setattr(Plugins, "check_usage", lambda _: None)
monkeypatch.setattr(plugin_instance, "_instantiate", lambda _: plugin)

msg = dedent(
"""
Plugin's setup() signature has changed in Hydra 1.1.
Support for the old style will be removed in Hydra 1.2.
For more info, check https://github.com/facebookresearch/hydra/pull/1581."""
)
with warns(expected_warning=UserWarning, match=re.escape(msg)):
classname = type(plugin).__name__
msg = f"setup() got an unexpected keyword argument 'hydra_context'"
with raises(TypeError, match=re.escape(msg)):
if isinstance(plugin, Launcher):
Plugins.instance().instantiate_launcher(
hydra_context=hydra_context,
task_function=task_function,
config=config,
config_loader=config_loader,
hydra_context=hydra_context,
)
else:
Plugins.instance().instantiate_sweeper(
Expand Down

0 comments on commit f2d2c2c

Please sign in to comment.