mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-12-18 20:23:49 +03:00
setup: use pytest instead of nose to run the test suite
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>
This commit is contained in:
16
setup.py
16
setup.py
@@ -286,13 +286,13 @@ class my_test(Command):
|
|||||||
self.build_platlib = os.path.join(self.build_base,
|
self.build_platlib = os.path.join(self.build_base,
|
||||||
'lib' + plat_specifier)
|
'lib' + plat_specifier)
|
||||||
|
|
||||||
def find_nosetests_path(self):
|
def find_pytest_path(self):
|
||||||
binaries = [
|
binaries = [
|
||||||
"nosetests-%d.%d" % (sys.version_info[0],
|
"pytest-%d.%d" % (sys.version_info[0],
|
||||||
sys.version_info[1]),
|
sys.version_info[1]),
|
||||||
"nosetests-%d" % (sys.version_info[0]),
|
"pytest-%d" % (sys.version_info[0]),
|
||||||
"nosetests%d" % (sys.version_info[0]),
|
"pytest%d" % (sys.version_info[0]),
|
||||||
"nosetests",
|
"pytest",
|
||||||
]
|
]
|
||||||
|
|
||||||
for binary in binaries:
|
for binary in binaries:
|
||||||
@@ -300,7 +300,7 @@ class my_test(Command):
|
|||||||
if path is not None:
|
if path is not None:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
raise Exception("Cannot find any nosetests binary")
|
raise Exception("Cannot find any pytest binary")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
@@ -314,8 +314,8 @@ class my_test(Command):
|
|||||||
else:
|
else:
|
||||||
os.environ["PYTHONPATH"] = self.build_platlib
|
os.environ["PYTHONPATH"] = self.build_platlib
|
||||||
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
|
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
|
||||||
nose = self.find_nosetests_path()
|
pytest = self.find_pytest_path()
|
||||||
self.spawn([sys.executable, nose])
|
self.spawn([sys.executable, pytest])
|
||||||
|
|
||||||
|
|
||||||
class my_clean(clean):
|
class my_clean(clean):
|
||||||
|
|||||||
Reference in New Issue
Block a user