async def test__add_monitor__no_aiomonitor(self, worker, loop): worker.log.warning = Mock() with mask_module('aiomonitor'): await worker._add_monitor() worker.log.warning.assert_called_once()
def test_load_extension_class_names__no_pkg_resources(): with mask_module('pkg_resources'): assert list(load_extension_class_names('foo')) == []
def test_fixup_env_enabled_no_django(self, *, app, fixup, monkeypatch): monkeypatch.setenv("DJANGO_SETTINGS_MODULE", "settings") with mask_module("django"): with pytest.warns(UserWarning): assert not fixup.enabled() assert not any(isinstance(f, Fixup) for f in fixups(app))
def test_load_extension_class_names__no_pkg_resources(): with mask_module("pkg_resources"): assert list(load_extension_class_names("foo")) == []