Deletes config cache after each test if it exists.

This commit is contained in:
Norman Jäckel 2013-08-19 12:41:29 +02:00
parent 25bac4a704
commit c88d180808
2 changed files with 11 additions and 3 deletions

View File

@ -25,6 +25,14 @@ class TestCase(_TestCase):
def _pre_setup(self, *args, **kwargs):
return_value = super(TestCase, self)._pre_setup(*args, **kwargs)
post_database_setup.send(sender=self)
# Resetting the config object by deleting the cache
del config._cache
return return_value
def _post_teardown(self, *args, **kwargs):
return_value = super(TestCase, self)._post_teardown(*args, **kwargs)
# Resets the config object by deleting the cache
try:
del config._cache
except AttributeError:
# The cache has only to be deleted if it exists.
pass
return return_value

View File

@ -24,7 +24,7 @@ from openslides.config.exceptions import ConfigError, ConfigNotFound
class HandleConfigTest(TestCase):
def get_config_var(self, key):
return config[key]
return config[key]
def test_get_config_default_value(self):
self.assertEqual(config['string_var'], 'default_string_rien4ooCZieng6ah')