#32100: Parameter KEY_PREFIX for DummyCache causing test runner to fail
-----------------------------------------------+------------------------
               Reporter:  kbhalerao            |          Owner:  nobody
                   Type:  Bug                  |         Status:  new
              Component:  Core (Cache system)  |        Version:  3.1
               Severity:  Normal               |       Keywords:
           Triage Stage:  Unreviewed           |      Has patch:  0
    Needs documentation:  0                    |    Needs tests:  0
Patch needs improvement:  0                    |  Easy pickings:  0
                  UI/UX:  0                    |
-----------------------------------------------+------------------------
 Summary:
 If the KEY_PREFIX option is present while using the DummyCache backend,
 the test runner fails with the traceback at the bottom. When running the
 server, there via runserver there is no issue.

 {{{
 CACHES = {
     'default': {
         'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
     },
     'KEY_PREFIX': "SomeKeyPrefix"
 }
 }}}

 {{{
 Traceback (most recent call last):
   File "/snap/pycharm-
 professional/215/plugins/python/helpers/pycharm/django_test_manage.py",
 line 168, in <module>
     utility.execute()
   File "/snap/pycharm-
 professional/215/plugins/python/helpers/pycharm/django_test_manage.py",
 line 142, in execute
     _create_command().run_from_argv(self.argv)
   File "/home/.../lib/python3.8/site-
 packages/django/core/management/commands/test.py", line 23, in
 run_from_argv
     super().run_from_argv(argv)
   File "/home/.../DJ3/lib/python3.8/site-
 packages/django/core/management/base.py", line 328, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/home/.../lib/python3.8/site-
 packages/django/core/management/base.py", line 369, in execute
     output = self.handle(*args, **options)
   File "/snap/pycharm-
 professional/215/plugins/python/helpers/pycharm/django_test_manage.py",
 line 104, in handle
     failures = TestRunner(test_labels, **options)
   File "/snap/pycharm-
 professional/215/plugins/python/helpers/pycharm/django_test_runner.py",
 line 254, in run_tests
     return DjangoTeamcityTestRunner(**options).run_tests(test_labels,
   File "/snap/pycharm-
 professional/215/plugins/python/helpers/pycharm/django_test_runner.py",
 line 156, in run_tests
     return super(DjangoTeamcityTestRunner, self).run_tests(test_labels,
 extra_tests, **kwargs)
   File "/home/.../lib/python3.8/site-packages/django/test/runner.py", line
 684, in run_tests
     old_config = self.setup_databases(aliases=databases)
   File "/home/.../lib/python3.8/site-packages/django/test/runner.py", line
 604, in setup_databases
     return _setup_databases(
   File "/home/.../lib/python3.8/site-packages/django/test/utils.py", line
 169, in setup_databases
     connection.creation.create_test_db(
   File "/home/.../lib/python3.8/site-
 packages/django/db/backends/base/creation.py", line 82, in create_test_db
     call_command('createcachetable', database=self.connection.alias)
   File "/home/.../lib/python3.8/site-
 packages/django/core/management/__init__.py", line 168, in call_command
     return command.execute(*args, **defaults)
   File "/home/.../lib/python3.8/site-
 packages/django/core/management/base.py", line 369, in execute
     output = self.handle(*args, **options)
   File "/home/.../lib/python3.8/site-
 packages/django/core/management/commands/createcachetable.py", line 42, in
 handle
     cache = caches[cache_alias]
   File "/home/.../lib/python3.8/site-
 packages/django/core/cache/__init__.py", line 79, in __getitem__
     cache = _create_cache(alias)
   File "/home/.../lib/python3.8/site-
 packages/django/core/cache/__init__.py", line 47, in _create_cache
     params = {**conf, **kwargs}
 TypeError: 'str' object is not a mapping
 }}}

 Error message is pretty clear, but likely requires a more general solution
 implemented in createcachetable.py when DummyCache backend is being used.

 Workaround: Do not add options to DummyCache backend, and potentially
 update documentation to indicate if options to DummyCache will be a
 problem.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32100>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.e4559bd4fb666b06d9f556edf217b689%40djangoproject.com.

Reply via email to