public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/g-sorcery:master commit in: tests/
Date: Tue,  4 May 2021 15:50:36 +0000 (UTC)	[thread overview]
Message-ID: <1620143288.d3e5cf43918fd6134ce258683a757d4f9778917b.ulm@gentoo> (raw)

commit:     d3e5cf43918fd6134ce258683a757d4f9778917b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 17:35:30 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> 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 <dolsen <AT> gentoo.org>
Signed-off-by: Ulrich Müller <ulm <AT> 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"))


             reply	other threads:[~2021-05-04 15:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-04 15:50 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-04 15:50 [gentoo-commits] proj/g-sorcery:master commit in: tests/ Ulrich Müller
2021-05-04 15:50 Ulrich Müller
2013-09-18 22:52 Jauhien Piatlicki
2013-09-18 22:52 Jauhien Piatlicki
2013-09-18 22:09 Jauhien Piatlicki
2013-09-18 22:09 Jauhien Piatlicki
2013-09-18  0:57 Jauhien Piatlicki
2013-09-16 14:33 Jauhien Piatlicki
2013-09-16  0:19 Jauhien Piatlicki
2013-09-15 22:38 Jauhien Piatlicki
2013-09-15 22:38 Jauhien Piatlicki
2013-09-15 22:38 Jauhien Piatlicki
2013-07-17 15:41 Jauhien Piatlicki
2013-07-14 23:39 Jauhien Piatlicki
2013-07-08 23:53 Jauhien Piatlicki
2013-07-02 14:48 Jauhien Piatlicki
2013-07-02 10:21 Jauhien Piatlicki
2013-06-23  0:44 Jauhien Piatlicki
2013-06-23  0:44 Jauhien Piatlicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1620143288.d3e5cf43918fd6134ce258683a757d4f9778917b.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox