@@ -40,7 +40,10 @@ class TestDependencyChecker(TestCase):
4040    def  mock_installed_package (
4141        self , distribution : Optional [DummyDistribution ]
4242    ) ->  Generator [None , None , None ]:
43-         """Pretend that looking up any distribution yields the given `distribution`.""" 
43+         """Pretend that looking up any package yields the given `distribution`. 
44+ 
45+         If `distribution = None`, we pretend that the package is not installed. 
46+         """ 
4447
4548        def  mock_distribution (name : str ):
4649            if  distribution  is  None :
@@ -81,7 +84,7 @@ def test_version_reported_as_none(self) -> None:
8184                self .assertRaises (DependencyException , check_requirements )
8285
8386    def  test_checks_ignore_dev_dependencies (self ) ->  None :
84-         """Bot  generic and per-extra checks should ignore dev dependencies.""" 
87+         """Both  generic and per-extra checks should ignore dev dependencies.""" 
8588        with  patch (
8689            "synapse.util.check_dependencies.metadata.requires" ,
8790            return_value = ["dummypkg >= 1; extra == 'mypy'" ],
@@ -142,3 +145,16 @@ def test_release_candidates_satisfy_dependency(self) -> None:
142145            with  self .mock_installed_package (new_release_candidate ):
143146                # should not raise 
144147                check_requirements ()
148+ 
149+     def  test_setuptools_rust_ignored (self ) ->  None :
150+         """Test a workaround for a `poetry build` problem. Reproduces #13926.""" 
151+         with  patch (
152+             "synapse.util.check_dependencies.metadata.requires" ,
153+             return_value = ["setuptools_rust >= 1.3" ],
154+         ):
155+             with  self .mock_installed_package (None ):
156+                 # should not raise, even if setuptools_rust is not installed 
157+                 check_requirements ()
158+             with  self .mock_installed_package (old ):
159+                 # We also ignore old versions of setuptools_rust 
160+                 check_requirements ()
0 commit comments