From da685e62da910dc7081f894570cb31e608eea8b5 Mon Sep 17 00:00:00 2001 From: shixuantong Date: Mon, 10 Jan 2022 14:03:50 +0800 Subject: [PATCH] add pytest 6.2+ support --- backport-pytest-Use-Node.from_parent.patch | 43 ++++++++++++++++++++++ python-docopt.spec | 7 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 backport-pytest-Use-Node.from_parent.patch diff --git a/backport-pytest-Use-Node.from_parent.patch b/backport-pytest-Use-Node.from_parent.patch new file mode 100644 index 0000000..f0643fb --- /dev/null +++ b/backport-pytest-Use-Node.from_parent.patch @@ -0,0 +1,43 @@ +From 8e06097d68b3f2fb9f44324119de5cefb7a42506 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 7 Jun 2021 00:52:25 +0200 +Subject: [PATCH] pytest: Use Node.from_parent(...) + +Fixes https://github.com/docopt/docopt/issues/483 + +See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent +--- + conftest.py | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/conftest.py b/conftest.py +index f5e8c7b..c4c0bb5 100644 +--- a/conftest.py ++++ b/conftest.py +@@ -11,7 +11,10 @@ + + def pytest_collect_file(path, parent): + if path.ext == ".docopt" and path.basename.startswith("test"): +- return DocoptTestFile(path, parent) ++ if hasattr(DocoptTestFile, "from_parent"): ++ return DocoptTestFile.from_parent(parent, fspath=path) ++ else: ++ return DocoptTestFile(path, parent) + + + def parse_test(raw): +@@ -41,7 +44,13 @@ def collect(self): + for name, doc, cases in parse_test(raw): + name = self.fspath.purebasename + for case in cases: +- yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case) ++ if hasattr(DocoptTestItem, "from_parent"): ++ yield DocoptTestItem.from_parent(parent=self, ++ name="%s(%d)" % (name, index), ++ doc=doc, ++ case=case) ++ else: ++ yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case) + index += 1 + + diff --git a/python-docopt.spec b/python-docopt.spec index de61628..7f75b6f 100644 --- a/python-docopt.spec +++ b/python-docopt.spec @@ -1,11 +1,13 @@ Name: python-docopt Version: 0.6.2 -Release: 12 +Release: 13 Summary: Command-line interface description language License: MIT URL: http://docopt.org/ Source0: https://github.com/docopt/docopt/archive/%{version}.tar.gz#/docopt-%{version}.tar.gz +Patch6000: backport-pytest-Use-Node.from_parent.patch + BuildArch: noarch %global _description \ @@ -43,6 +45,9 @@ py.test-3 -v %{python3_sitelib}/__pycache__/* %changelog +* Mon Jan 10 2022 shixuantong - 0.6.2-13 +- add pytest 6.2+ support + * Sat Oct 24 2020 tianwei - 0.6.2-12 - delete python2 -- Gitee