summary refs log tree commit diff
path: root/tests/util
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-03-08 15:37:35 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-03-08 15:37:35 +0000
commit0dc9c5653c990687f7aa912f1b1279d94b433826 (patch)
treec785afc95a1cd5870eb400b6616a81cc3b07b107 /tests/util
parentFix CI not attaching source distributions and wheels to the GitHub releases. ... (diff)
parentFix silly markdown typo (diff)
downloadsynapse-0dc9c5653c990687f7aa912f1b1279d94b433826.tar.xz
Merge branch 'master' into develop
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/test_check_dependencies.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/util/test_check_dependencies.py b/tests/util/test_check_dependencies.py
index a91c33272f..38e9f58ac6 100644
--- a/tests/util/test_check_dependencies.py
+++ b/tests/util/test_check_dependencies.py
@@ -27,7 +27,9 @@ class DummyDistribution(metadata.Distribution):
 
 
 old = DummyDistribution("0.1.2")
+old_release_candidate = DummyDistribution("0.1.2rc3")
 new = DummyDistribution("1.2.3")
+new_release_candidate = DummyDistribution("1.2.3rc4")
 
 # could probably use stdlib TestCase --- no need for twisted here
 
@@ -110,3 +112,20 @@ class TestDependencyChecker(TestCase):
             with self.mock_installed_package(new):
                 # should not raise
                 check_requirements("cool-extra")
+
+    def test_release_candidates_satisfy_dependency(self) -> None:
+        """
+        Tests that release candidates count as far as satisfying a dependency
+        is concerned.
+        (Regression test, see #12176.)
+        """
+        with patch(
+            "synapse.util.check_dependencies.metadata.requires",
+            return_value=["dummypkg >= 1"],
+        ):
+            with self.mock_installed_package(old_release_candidate):
+                self.assertRaises(DependencyException, check_requirements)
+
+            with self.mock_installed_package(new_release_candidate):
+                # should not raise
+                check_requirements()