diff test/test_config.py @ 6821:e0f0aed72097

Fix test if redis is not loaded handle the KeyError from trying to remove redis from sys.modules if it not loaded.
author John Rouillard <rouilj@ieee.org>
date Sun, 07 Aug 2022 00:45:06 -0400
parents 3f60a71b0812
children 89a59e46b3af
line wrap: on
line diff
--- a/test/test_config.py	Sun Aug 07 00:43:31 2022 -0400
+++ b/test/test_config.py	Sun Aug 07 00:45:06 2022 -0400
@@ -814,7 +814,12 @@
         config.SESSIONDB_BACKEND = "redis"
 
         # make it looks like redis is not available
-        del(sys.modules['redis'])
+        try:
+            del(sys.modules['redis'])
+        except KeyError:
+            # redis is not available anyway.
+            pass
+
         sys.modules['redis'] = None
         with self.assertRaises(configuration.OptionValueError) as cm:
             config.validator(config.options)

Roundup Issue Tracker: http://roundup-tracker.org/