summary refs log tree commit diff
path: root/tests/util/test_check_dependencies.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2022-03-04 22:40:51 +0000
committerRichard van der Hoff <richard@matrix.org>2022-03-04 22:40:51 +0000
commit00a67f831adc7c01fcced6269cb5790816252493 (patch)
tree61c126514e6a1c8ebe81bd5ac38efe51e622b26a /tests/util/test_check_dependencies.py
parentReduce to-device queries for /sync. (#12163) (diff)
parentRelax version guard for packaging (#12166) (diff)
downloadsynapse-00a67f831adc7c01fcced6269cb5790816252493.tar.xz
Merge remote-tracking branch 'origin/release-v1.54' into develop
Diffstat (limited to 'tests/util/test_check_dependencies.py')
-rw-r--r--tests/util/test_check_dependencies.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/util/test_check_dependencies.py b/tests/util/test_check_dependencies.py
index 3c07252252..a91c33272f 100644
--- a/tests/util/test_check_dependencies.py
+++ b/tests/util/test_check_dependencies.py
@@ -65,6 +65,23 @@ class TestDependencyChecker(TestCase):
                 # should not raise
                 check_requirements()
 
+    def test_checks_ignore_dev_dependencies(self) -> None:
+        """Bot generic and per-extra checks should ignore dev dependencies."""
+        with patch(
+            "synapse.util.check_dependencies.metadata.requires",
+            return_value=["dummypkg >= 1; extra == 'mypy'"],
+        ), patch("synapse.util.check_dependencies.RUNTIME_EXTRAS", {"cool-extra"}):
+            # We're testing that none of these calls raise.
+            with self.mock_installed_package(None):
+                check_requirements()
+                check_requirements("cool-extra")
+            with self.mock_installed_package(old):
+                check_requirements()
+                check_requirements("cool-extra")
+            with self.mock_installed_package(new):
+                check_requirements()
+                check_requirements("cool-extra")
+
     def test_generic_check_of_optional_dependency(self) -> None:
         """Complain if an optional package is old."""
         with patch(
@@ -85,11 +102,11 @@ class TestDependencyChecker(TestCase):
         with patch(
             "synapse.util.check_dependencies.metadata.requires",
             return_value=["dummypkg >= 1; extra == 'cool-extra'"],
-        ), patch("synapse.util.check_dependencies.EXTRAS", {"cool-extra"}):
+        ), patch("synapse.util.check_dependencies.RUNTIME_EXTRAS", {"cool-extra"}):
             with self.mock_installed_package(None):
                 self.assertRaises(DependencyException, check_requirements, "cool-extra")
             with self.mock_installed_package(old):
                 self.assertRaises(DependencyException, check_requirements, "cool-extra")
             with self.mock_installed_package(new):
                 # should not raise
-                check_requirements()
+                check_requirements("cool-extra")