Files
zira-etc/mail/spamassassin/pyzor-0.7.0/tests/functional/test_redis.py
2021-05-24 22:18:33 +03:00

41 lines
1.1 KiB
Python

import unittest
try:
import redis
except ImportError:
redis = None
from tests.util import *
@unittest.skipIf(redis == None, "redis library not available")
class RedisPyzorTest(PyzorTest, PyzorTestBase):
"""Test the redis engine"""
dsn = "localhost,,,10"
engine = "redis"
@classmethod
def tearDownClass(cls):
super(RedisPyzorTest, cls).tearDownClass()
redis.StrictRedis(db=10).flushdb()
class ThreadsRedisPyzorTest(RedisPyzorTest):
"""Test the redis engine with threads activated."""
threads = "True"
class MaxThreadsRedisPyzorTest(RedisPyzorTest):
"""Test the gdbm engine with with maximum threads."""
threads = "True"
max_threads = "10"
def suite():
"""Gather all the tests from this module in a test suite."""
test_suite = unittest.TestSuite()
test_suite.addTest(unittest.makeSuite(RedisPyzorTest))
test_suite.addTest(unittest.makeSuite(ThreadsRedisPyzorTest))
test_suite.addTest(unittest.makeSuite(MaxThreadsRedisPyzorTest))
return test_suite
if __name__ == '__main__':
unittest.main()