id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 27132,Allowed testing MemcachedCache and PyLibMCCache during the same test run,Ed Morley,Ed Morley,"Currently jenkins only tests against MemcachedCache (ie python-memcached). In order to make changes like those in #20892 easier to test, it would be useful if PyLibMCCache were tested on jenkins too. This will likely involve: * Adding a PyLibMCCache config to the jenkins configs (not sure whether these are in a public repo somewhere?) * Refactoring tests/cache/tests.py, such that: - `MemcachedCacheTests` is split into a base class (that isn't a subclass of `TestCase`) plus `MemcachedCacheTests` and `PyLibMCCacheTests` - the vast majority of tests are kept in the base class, with just the binding-specific tests in the subclasses - the subclasses have appropriate `@skipUnless()` and `@override_settings()` For example: {{{ MemcachedCache_params = {} PyLibMCCache_params = {} for _cache_params in settings.CACHES.values(): backend = _cache_params['BACKEND'] if backend == 'django.core.cache.backends.memcached.MemcachedCache': MemcachedCache = _cache_params elif backend == 'django.core.cache.backends.memcached.PyLibMCCache': PyLibMCCache_params = _cache_params # ... class BaseMemcachedTests(BaseCacheTests): def test_foo(self): # ... @unittest.skipUnless(MemcachedCache_params, ""MemcachedCache backend not configured"") @override_settings(CACHES=caches_setting_for_tests( base=MemcachedCache_params, exclude=memcached_excluded_caches, )) class MemcachedCacheTests(BaseMemcachedTests, TestCase): def test_python_memcached__foo(self): # ... @unittest.skipUnless(PyLibMCCache_params, ""PyLibMCCache backend not configured"") @override_settings(CACHES=caches_setting_for_tests( base=PyLibMCCache_params, exclude=memcached_excluded_caches, )) class PyLibMCCacheTests(BaseMemcachedTests, TestCase): def test_pylibmc_foo(self): # ... }}} However, there are both class level uses of `@override_settings()` and also per-test uses, and the per-test uses are for tests that will be in the base class `BaseMemcachedTests`. What's the preferred way to inherit settings from the class-level `@override_settings()` usage of the subclasses (eg `PyLibMCCacheTests`), and to then modify them further on the tests run on the base class?",Cleanup/optimization,closed,Core (Cache system),dev,Normal,fixed,,emorley@…,Accepted,1,0,0,0,0,0