[Pkg-libvirt-commits] [Git][libvirt-team/osinfo-db][debian/sid] test_jessie autopkgtest: switch from unittest to pytest
Pino Toscano (@pino)
gitlab at salsa.debian.org
Wed Aug 31 05:43:06 BST 2022
Pino Toscano pushed to branch debian/sid at Libvirt Packaging Team / osinfo-db
Commits:
6dbd29ef by Pino Toscano at 2022-08-31T06:41:16+02:00
test_jessie autopkgtest: switch from unittest to pytest
Since we are using already pytest to run this test, use its API to make
it simpler. There is no behaviour change.
Gbp-Dch: Short
- - - - -
1 changed file:
- debian/tests/test_jessie.py
Changes:
=====================================
debian/tests/test_jessie.py
=====================================
@@ -1,34 +1,34 @@
#!/usr/bin/python3
-import unittest
+import pytest
import gi
gi.require_version('Libosinfo', '1.0')
from gi.repository import Libosinfo as osinfo;
-class TestJessie(unittest.TestCase):
- def setUp(self):
- self.loader = osinfo.Loader()
- self.loader.process_default_path()
- self.db = self.loader.get_db()
+ at pytest.fixture(scope="session")
+def db():
+ loader = osinfo.Loader()
+ loader.process_default_path()
+ return loader.get_db()
- def testVirtio(self):
- """
- Make sure jessie has virtio devices
- """
- osid = "http://debian.org/debian/8"
- os = self.db.get_os(osid)
- devs = os.get_all_devices()
- devnames = []
- for idx in range(devs.get_length()):
- devnames.append(devs.get_nth(idx).get_name())
+def testVirtio(db):
+ """
+ Make sure jessie has virtio devices
+ """
+ osid = "http://debian.org/debian/8"
+ os = db.get_os(osid)
+ devs = os.get_all_devices()
+ devnames = []
- self.assertIn("virtio-net", devnames)
- self.assertIn("virtio-block", devnames)
- self.assertIn("virtio-rng", devnames)
- self.assertIn("virtio-scsi", devnames)
- self.assertIn("virtio-balloon", devnames)
- self.assertIn("virtio-9p", devnames)
+ for idx in range(devs.get_length()):
+ devnames.append(devs.get_nth(idx).get_name())
+ assert "virtio-net" in devnames
+ assert "virtio-block" in devnames
+ assert "virtio-rng" in devnames
+ assert "virtio-scsi" in devnames
+ assert "virtio-balloon" in devnames
+ assert "virtio-9p" in devnames
View it on GitLab: https://salsa.debian.org/libvirt-team/osinfo-db/-/commit/6dbd29ef26d69257961ac37020a26d476385db74
--
View it on GitLab: https://salsa.debian.org/libvirt-team/osinfo-db/-/commit/6dbd29ef26d69257961ac37020a26d476385db74
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20220831/d26cebac/attachment-0001.htm>
More information about the Pkg-libvirt-commits
mailing list