1 Star 0 Fork 20

lvxiaoqian/python-testtools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix-testsuite-failed.patch 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
caodongxia 提交于 2022-04-02 11:14 . fix test failed due to python3.10
From d528842b99b16efce212e15dae3f0a54927d06d8 Mon Sep 17 00:00:00 2001
From: Cyril Roelandt <cyril@redhat.com>
Date: Fri, 19 Mar 2021 02:50:13 +0000
Subject: [PATCH] Fix tests with Python 3.10
In Python 3, error messages have become a bit more precise. For
instance, the following code snippet:
----
class Foo():
def bar(self, a):
pass
try:
Foo().bar(1, 2)
except TypeError as e:
print(e)
----
will return:
- in Python 3.9: "bar() takes 2 positional arguments but 3 were given"
- in Python 3.10: "Foo.bar() takes 2 positional arguments but 3 were
given"
Fix our tests accordingly.
---
testtools/tests/test_testsuite.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testtools/tests/test_testsuite.py b/testtools/tests/test_testsuite.py
index 7ad5b74d..65cb88d7 100644
--- a/testtools/tests/test_testsuite.py
+++ b/testtools/tests/test_testsuite.py
@@ -181,7 +181,7 @@ def run(self):
test.run(process_result)
""", doctest.ELLIPSIS))
self.assertThat(events[3][6].decode('utf8'), DocTestMatches("""\
-TypeError: run() takes ...1 ...argument...2...given...
+TypeError: ...run() takes ...1 ...argument...2...given...
""", doctest.ELLIPSIS))
events = [event[0:10] + (None,) for event in events]
events[1] = events[1][:6] + (None,) + events[1][7:]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lvxiaoqian/python-testtools.git
git@gitee.com:lvxiaoqian/python-testtools.git
lvxiaoqian
python-testtools
python-testtools
master

搜索帮助