Giuseppe Lavagetto has submitted this change and it was merged. Change subject: tests: catch KVObject.setup() SystemExit ......................................................................
tests: catch KVObject.setup() SystemExit The KVObject.setup() invokes a backend which will sys.exit(3) when something goes wrong. Catch the exception and log in through a logger. Flag the initialization fail so we can fail() all the tests. Change-Id: I422c80ace8a1111ccdafbdd495196a6120f81ae8 --- M conftool/tests/integration/__init__.py 1 file changed, 13 insertions(+), 1 deletion(-) Approvals: Giuseppe Lavagetto: Verified; Looks good to me, approved diff --git a/conftool/tests/integration/__init__.py b/conftool/tests/integration/__init__.py index 71592cf..ab2f4e8 100644 --- a/conftool/tests/integration/__init__.py +++ b/conftool/tests/integration/__init__.py @@ -60,6 +60,8 @@ class IntegrationTestBase(unittest.TestCase): + log = logging.getLogger(__name__) + @classmethod def setUpClass(cls): program = cls._get_exe() @@ -70,7 +72,17 @@ cls.processHelper.run() cls.fixture_dir = os.path.join(test_base, 'fixtures') conf = configuration.Config(driver_options={'allow_reconnect': True}) - KVObject.setup(conf) + try: + KVObject.setup(conf) + except SystemExit as system_exit: + cls.log.critical("KVObject.setup() failed. sys.exit(%s)" + % system_exit, + exc_info=1) + cls.init_failed = True + + def setUp(self): + if self.init_failed: + self.fail("Failed to initialize %s" % __name__) @classmethod def tearDownClass(cls): -- To view, visit https://gerrit.wikimedia.org/r/222313 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I422c80ace8a1111ccdafbdd495196a6120f81ae8 Gerrit-PatchSet: 1 Gerrit-Project: operations/software/conftool Gerrit-Branch: master Gerrit-Owner: Hashar <has...@free.fr> Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org> Gerrit-Reviewer: Hashar <has...@free.fr> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits