From 8f41e98220749e64164a5c9346e9875af3489a1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 6 Apr 2021 20:07:25 +0200
Subject: [PATCH 1/6] setup: use pytest instead of nose to run the test suite
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The software we use for running tests - nose - has been
deprecated in favor of nose2.

We don't use anything nose-specific, just unittest.TestCase,
which pytest can handle just fine.

Switch to using pytest, which we already use for libvirt-dbus.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 setup.py | 16 ++++++++--------
 tox.ini  |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/setup.py b/setup.py
index 56b6eea..ffb0e13 100755
--- a/setup.py
+++ b/setup.py
@@ -292,13 +292,13 @@ class my_test(Command):
             self.build_platlib = os.path.join(self.build_base,
                                               'lib' + plat_specifier)
 
-    def find_nosetests_path(self):
+    def find_pytest_path(self):
         binaries = [
-            "nosetests-%d.%d" % (sys.version_info[0],
+            "pytest-%d.%d" % (sys.version_info[0],
                                  sys.version_info[1]),
-            "nosetests-%d" % (sys.version_info[0]),
-            "nosetests%d" % (sys.version_info[0]),
-            "nosetests",
+            "pytest-%d" % (sys.version_info[0]),
+            "pytest%d" % (sys.version_info[0]),
+            "pytest",
         ]
 
         for binary in binaries:
@@ -306,7 +306,7 @@ class my_test(Command):
             if path is not None:
                 return path
 
-        raise Exception("Cannot find any nosetests binary")
+        raise Exception("Cannot find any pytest binary")
 
     def run(self):
         """
@@ -320,8 +320,8 @@ class my_test(Command):
         else:
             os.environ["PYTHONPATH"] = self.build_platlib
         self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
-        nose = self.find_nosetests_path()
-        self.spawn([sys.executable, nose])
+        pytest = self.find_pytest_path()
+        self.spawn([sys.executable, pytest])
 
 
 class my_clean(clean):
diff --git a/tox.ini b/tox.ini
index de683b9..24c96c2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@ envlist = py36,py37,py38
 [testenv]
 deps=
     lxml
-    nose
+    pytest
 commands=
     python sanitytest.py
-    nosetests
+    pytest
-- 
2.27.0