mirror of
				https://github.com/django/django.git
				synced 2025-10-29 08:36:09 +00:00 
			
		
		
		
	[1.10.x] Fixed #19914 -- Fixed test failures with pylibmc.
Backport of 674e3fe13e from master
			
			
This commit is contained in:
		
							
								
								
									
										17
									
								
								tests/cache/tests.py
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								tests/cache/tests.py
									
									
									
									
										vendored
									
									
								
							| @@ -1204,7 +1204,15 @@ class BaseMemcachedTests(BaseCacheTests): | |||||||
|         self.assertEqual(cache.get('small_value'), 'a') |         self.assertEqual(cache.get('small_value'), 'a') | ||||||
|  |  | ||||||
|         large_value = 'a' * (max_value_length + 1) |         large_value = 'a' * (max_value_length + 1) | ||||||
|  |         try: | ||||||
|             cache.set('small_value', large_value) |             cache.set('small_value', large_value) | ||||||
|  |         except Exception: | ||||||
|  |             # Some clients (e.g. pylibmc) raise when the value is too large, | ||||||
|  |             # while others (e.g. python-memcached) intentionally return True | ||||||
|  |             # indicating success. This test is primarily checking that the key | ||||||
|  |             # was deleted, so the return/exception behavior for the set() | ||||||
|  |             # itself is not important. | ||||||
|  |             pass | ||||||
|         # small_value should be deleted, or set if configured to accept larger values |         # small_value should be deleted, or set if configured to accept larger values | ||||||
|         value = cache.get('small_value') |         value = cache.get('small_value') | ||||||
|         self.assertTrue(value is None or value == large_value) |         self.assertTrue(value is None or value == large_value) | ||||||
| @@ -1232,6 +1240,15 @@ class MemcachedCacheTests(BaseMemcachedTests, TestCase): | |||||||
| class PyLibMCCacheTests(BaseMemcachedTests, TestCase): | class PyLibMCCacheTests(BaseMemcachedTests, TestCase): | ||||||
|     base_params = PyLibMCCache_params |     base_params = PyLibMCCache_params | ||||||
|  |  | ||||||
|  |     # By default, pylibmc/libmemcached don't verify keys client-side and so | ||||||
|  |     # this test triggers a server-side bug that causes later tests to fail | ||||||
|  |     # (#19914). The `verify_keys` behavior option could be set to True (which | ||||||
|  |     # would avoid triggering the server-side bug), however this test would | ||||||
|  |     # still fail due to https://github.com/lericson/pylibmc/issues/219. | ||||||
|  |     @unittest.skip("triggers a memcached-server bug, causing subsequent tests to fail") | ||||||
|  |     def test_invalid_key_characters(self): | ||||||
|  |         pass | ||||||
|  |  | ||||||
|  |  | ||||||
| @override_settings(CACHES=caches_setting_for_tests( | @override_settings(CACHES=caches_setting_for_tests( | ||||||
|     BACKEND='django.core.cache.backends.filebased.FileBasedCache', |     BACKEND='django.core.cache.backends.filebased.FileBasedCache', | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user