From 53e9772beef705791c151247e1e4058f5ea5a8f6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 28 Oct 2020 18:11:30 +0000 Subject: [PATCH 1/3] Don't require hiredis to run unit tests --- tests/replication/_base.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/replication/_base.py b/tests/replication/_base.py index 093e2faac7bf..87ca6517f07c 100644 --- a/tests/replication/_base.py +++ b/tests/replication/_base.py @@ -16,7 +16,6 @@ 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 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 depency so we don't want to require it for running + # the tests. + if not hiredis: + skip = "Requires hiredis" + servlets = [ streams.register_servlets, ] From 0cc4fb94cc0a8c9566ffbed17ff66232b7a0164a Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 28 Oct 2020 18:12:23 +0000 Subject: [PATCH 2/3] Newsfile --- changelog.d/8680.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/8680.misc diff --git a/changelog.d/8680.misc b/changelog.d/8680.misc new file mode 100644 index 000000000000..2ca297546498 --- /dev/null +++ b/changelog.d/8680.misc @@ -0,0 +1 @@ +Don't require `hiredis` package to be installed to run unit tests. From e3c73851e0758ae0a88c6927c7d00035e43b4dd9 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 28 Oct 2020 14:20:09 -0400 Subject: [PATCH 3/3] Fix typo --- tests/replication/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/replication/_base.py b/tests/replication/_base.py index 87ca6517f07c..8f7f9c8f7570 100644 --- a/tests/replication/_base.py +++ b/tests/replication/_base.py @@ -49,7 +49,7 @@ class BaseStreamTestCase(unittest.HomeserverTestCase): """Base class for tests of the replication streams""" - # hiredis is an optional depency so we don't want to require it for running + # hiredis is an optional dependency so we don't want to require it for running # the tests. if not hiredis: skip = "Requires hiredis"