def test_import_error(self, os, imp): imp.find_module.side_effect = ImportError() with pytest.raises(ConfigurationError): get_config_module()
def test_missing_home(self, os, imp): os.path.exists.return_value = False imp.find_module.return_value = Mock(), Mock(), Mock() get_config_module() assert_called_once_with(os.mkdir, ANY)
def test_get_config_module(self, os, imp): os.path.exists.return_value = True imp.find_module.return_value = Mock(), Mock(), Mock() imp.load_module.return_value = sentinel.config assert get_config_module() is sentinel.config