fix dogpile.cache issue due to the new usage of decorate in the lib

Since few months ago dogpile.cache start to use the 'decorator' module
on dogpile cache region to preserve signatures[1] within decorated
functions.

Since these changes was introduced and since oslo.cache have
removed dogpile.cache version restriction this feature is now in use on
oslo.cache and they introduce an issue on unit test where we use
decorator to test return values.

This patch introduce `**kw` passed to the decorated function to prevent
issue due to 'decorator' on region.

Openstacksdk was also impacted[2] by the changes introduced in dogpile 0.7.0.

An issue was also opened on dogpile.cache side[3]

[1] https://gerrit.sqlalchemy.org/#/c/sqlalchemy/dogpile.cache/+/996/
[2] https://review.openstack.org/#/c/625370/4
[3] https://github.com/sqlalchemy/dogpile.cache/issues/144

Change-Id: Ic9370f36b14c1420eace874dd322183eba8df171
Closes-Bug: #1817032
This commit is contained in:
Hervé Beraud 2019-02-26 19:21:48 +01:00
parent 62b5309986
commit b1f231f642
1 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@ class CacheRegionTest(BaseTestCase):
self.config_fixture.conf, region, group='cache')
@memoize
def cacheable_function(value=0):
def cacheable_function(value=0, **kw):
return value
return cacheable_function
@ -321,7 +321,7 @@ class CacheRegionTest(BaseTestCase):
self.config_fixture.config(group='cache', enabled=True)
self.assertRaises(ValueError,
cacheable_function,
value=self.test_value)
value=0, foo=self.test_value)
def test_kwarg_function_key_generator_no_kwargs(self):
cacheable_function = self._get_cacheable_function(