From e37228e6614ae638d6d0b5cf6bb5f22ba1ce76e4 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 6 Apr 2021 12:12:53 +0100 Subject: [PATCH 1/2] Fix reported bugbear: too broad exception assertion --- tests/config/test_load.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/config/test_load.py b/tests/config/test_load.py index 734a9983e832..c109425671ef 100644 --- a/tests/config/test_load.py +++ b/tests/config/test_load.py @@ -20,6 +20,7 @@ import yaml +from synapse.config import ConfigError from synapse.config.homeserver import HomeServerConfig from tests import unittest @@ -35,9 +36,9 @@ def tearDown(self): def test_load_fails_if_server_name_missing(self): self.generate_config_and_remove_lines_containing("server_name") - with self.assertRaises(Exception): + with self.assertRaises(ConfigError): HomeServerConfig.load_config("", ["-c", self.file]) - with self.assertRaises(Exception): + with self.assertRaises(ConfigError): HomeServerConfig.load_or_generate_config("", ["-c", self.file]) def test_generates_and_loads_macaroon_secret_key(self): From a5af76bdd3b0660277ad9f4abce28a5ac426db11 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 6 Apr 2021 12:17:16 +0100 Subject: [PATCH 2/2] Changelog --- changelog.d/9753.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/9753.misc diff --git a/changelog.d/9753.misc b/changelog.d/9753.misc new file mode 100644 index 000000000000..31184fe0bd1a --- /dev/null +++ b/changelog.d/9753.misc @@ -0,0 +1 @@ +Check that a `ConfigError` is raised, rather than simply `Exception`, when appropriate in homeserver config file generation tests. \ No newline at end of file