Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 6820:feb175271f3e | 6821:e0f0aed72097 |
|---|---|
| 812 | 812 |
| 813 config.RDBMS_BACKEND = "anydbm" | 813 config.RDBMS_BACKEND = "anydbm" |
| 814 config.SESSIONDB_BACKEND = "redis" | 814 config.SESSIONDB_BACKEND = "redis" |
| 815 | 815 |
| 816 # make it looks like redis is not available | 816 # make it looks like redis is not available |
| 817 del(sys.modules['redis']) | 817 try: |
| 818 del(sys.modules['redis']) | |
| 819 except KeyError: | |
| 820 # redis is not available anyway. | |
| 821 pass | |
| 822 | |
| 818 sys.modules['redis'] = None | 823 sys.modules['redis'] = None |
| 819 with self.assertRaises(configuration.OptionValueError) as cm: | 824 with self.assertRaises(configuration.OptionValueError) as cm: |
| 820 config.validator(config.options) | 825 config.validator(config.options) |
| 821 del(sys.modules['redis']) | 826 del(sys.modules['redis']) |
| 822 | 827 |
