Debian Codegraph @

debian/patches/pytest6

raw
1 From: Michael R. Crusoe <[email protected]>
2 Subject: fix for pytest 6.x comptability
3 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=979285
4 Forwarded: https://github.com/docopt/docopt/pull/493
5
6 --- docopt.orig/conftest.py
7 +++ docopt/conftest.py
8 @@ -11,6 +11,8 @@
9
10 def pytest_collect_file(path, parent):
11 if path.ext == ".docopt" and path.basename.startswith("test"):
12 + if hasattr(DocoptTestFile, "from_parent"):
13 + return DocoptTestFile.from_parent(parent, fspath=path)
14 return DocoptTestFile(path, parent)
15
16
17 @@ -41,7 +43,10 @@
18 for name, doc, cases in parse_test(raw):
19 name = self.fspath.purebasename
20 for case in cases:
21 - yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case)
22 + if hasattr(DocoptTestItem, "from_parent"):
23 + yield DocoptTestItem.from_parent(self, name="%s(%d)" % (name, index), doc=doc, case=case)
24 + else:
25 + yield DocoptTestItem("%s(%d)" % (name, index), self, doc, case)
26 index += 1
27
28