mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-20 12:59:21 +03:00
Fix running of nosetests on python 3
Previously the way Fedora installed /usr/bin/nosetests allowed it to be invoked with either python 2 or 3. Since Fedora 25 though, it contains a module name that only exists on python 2. So we need to be more intelligent and pick a different nosetests binary per version. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
17
setup.py
17
setup.py
@ -277,6 +277,20 @@ 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):
|
||||||
|
paths = [
|
||||||
|
"/usr/bin/nosetests-%d.%d" % (sys.version_info[0],
|
||||||
|
sys.version_info[1]),
|
||||||
|
"/usr/bin/nosetests-%d" % (sys.version_info[0]),
|
||||||
|
"/usr/bin/nosetests",
|
||||||
|
]
|
||||||
|
|
||||||
|
for path in paths:
|
||||||
|
if os.path.exists(path):
|
||||||
|
return path
|
||||||
|
|
||||||
|
raise Exception("Cannot find any nosetests binary")
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
Run test suite
|
Run test suite
|
||||||
@ -289,7 +303,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]])
|
||||||
self.spawn([sys.executable, "/usr/bin/nosetests"])
|
nose = self.find_nosetests_path()
|
||||||
|
self.spawn([sys.executable, nose])
|
||||||
|
|
||||||
|
|
||||||
class my_clean(clean):
|
class my_clean(clean):
|
||||||
|
Reference in New Issue
Block a user