Don't require hiredis to run unit tests (#8680)

pull/8685/head
Erik Johnston 2020-10-29 11:17:35 +00:00 committed by GitHub
parent c97da1e45d
commit 9a7e0d2ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

1
changelog.d/8680.misc Normal file
View File

@ -0,0 +1 @@
Don't require `hiredis` package to be installed to run unit tests.

View File

@ -16,7 +16,6 @@ import logging
from typing import Any, Callable, List, Optional, Tuple
import attr
import hiredis
from twisted.internet.interfaces import IConsumer, IPullProducer, IReactorTime
from twisted.internet.protocol import Protocol
@ -39,12 +38,22 @@ from synapse.util import Clock
from tests import unittest
from tests.server import FakeTransport, render
try:
import hiredis
except ImportError:
hiredis = None
logger = logging.getLogger(__name__)
class BaseStreamTestCase(unittest.HomeserverTestCase):
"""Base class for tests of the replication streams"""
# hiredis is an optional dependency so we don't want to require it for running
# the tests.
if not hiredis:
skip = "Requires hiredis"
servlets = [
streams.register_servlets,
]