From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EF07E13835A for ; Tue, 4 May 2021 15:50:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3E9B6E0830; Tue, 4 May 2021 15:50:39 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 29643E0830 for ; Tue, 4 May 2021 15:50:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1BCA333BF35 for ; Tue, 4 May 2021 15:50:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7A10C745 for ; Tue, 4 May 2021 15:50:36 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1620143288.d3e5cf43918fd6134ce258683a757d4f9778917b.ulm@gentoo> Subject: [gentoo-commits] proj/g-sorcery:master commit in: tests/ X-VCS-Repository: proj/g-sorcery X-VCS-Files: tests/test_DBGenerator.py tests/test_PackageDB.py X-VCS-Directories: tests/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: d3e5cf43918fd6134ce258683a757d4f9778917b X-VCS-Branch: master Date: Tue, 4 May 2021 15:50:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c7d70634-f9a2-4855-9e6c-906db58e04ac X-Archives-Hash: 349e5826046c4d54c036578bb7d9b35a commit: d3e5cf43918fd6134ce258683a757d4f9778917b Author: Brian Dolbec gentoo org> AuthorDate: Thu Apr 23 17:35:30 2020 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Tue May 4 15:48:08 2021 +0000 URL: https://gitweb.gentoo.org/proj/g-sorcery.git/commit/?id=d3e5cf43 test_DBGenerator.py, test_PackageDB.py: Fix test errors The http server was not being shutdown when exceptions were raised This caused other errors in tests run after the failed test. Signed-off-by: Brian Dolbec gentoo.org> Signed-off-by: Ulrich Müller gentoo.org> tests/test_DBGenerator.py | 12 +++++++----- tests/test_PackageDB.py | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/test_DBGenerator.py b/tests/test_DBGenerator.py index 9a47c86..3c28278 100644 --- a/tests/test_DBGenerator.py +++ b/tests/test_DBGenerator.py @@ -4,9 +4,9 @@ """ test_DBGenerator.py ~~~~~~~~~~~~~~~~~~~ - + DBGenerator test suite - + :copyright: (c) 2013 by Jauhien Piatlicki :license: GPL-2, see LICENSE for more details. """ @@ -81,11 +81,13 @@ class TestDBGenerator(BaseTest): srv = Server(orig_tempdir.name) srv.start() - pkg_db = db_generator(self.tempdir.name, "test_repo", + try: + pkg_db = db_generator(self.tempdir.name, "test_repo", common_config = common_config, config = config) - srv.shutdown() - srv.join() + finally: + srv.shutdown() + srv.join() self.assertEqual(set(pkg_db.list_categories()), set(["app-test1", "app-test2"])) self.assertTrue(pkg_db.in_category("app-test1", "test")) diff --git a/tests/test_PackageDB.py b/tests/test_PackageDB.py index 152c605..8be8f8a 100644 --- a/tests/test_PackageDB.py +++ b/tests/test_PackageDB.py @@ -70,11 +70,13 @@ class TestPackageDB(BaseTest): srv = Server(orig_tempdir.name, port=port) srv.start() - self.assertRaises(IntegrityError, test_db.sync, sync_address) - os.system("cd " + orig_tempdir.name + " && mv good.tar.gz dummy.tar.gz") - test_db.sync(sync_address) - srv.shutdown() - srv.join() + try: + self.assertRaises(IntegrityError, test_db.sync, sync_address) + os.system("cd " + orig_tempdir.name + " && mv good.tar.gz dummy.tar.gz") + test_db.sync(sync_address) + finally: + srv.shutdown() + srv.join() test_db.read() self.assertEqual(orig_db.database, test_db.database) self.assertEqual(orig_db.get_common_data("app-test1"), test_db.get_common_data("app-test1"))