#27132: Test PyLibMCCache on Jenkins
--------------------------------------+--------------------
     Reporter:  edmorley              |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  Core (Cache system)   |    Version:  master
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  0                     |      UI/UX:  0
--------------------------------------+--------------------
 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?

--
Ticket URL: <https://code.djangoproject.com/ticket/27132>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.417818706e64ae9efff710f52e8f5130%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to