1 Star 0 Fork 17

shechenglong/libvirt-python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setup-use-pytest-instead-of-nose-to-run-the-test-sui.patch 2.43 KB
一键复制 编辑 原始数据 按行查看 历史
imxcc 提交于 2022-01-11 10:49 +08:00 . spec: use pytest instead of nose
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dog-life/libvirt-python.git
git@gitee.com:dog-life/libvirt-python.git
dog-life
libvirt-python
libvirt-python
master

搜索帮助

371d5123 14472233 46e8bd33 14472233