MCPcopy
hub / github.com/pytest-dev/pytest / newinstance

Method newinstance

src/_pytest/unittest.py:84–90  ·  src/_pytest/unittest.py::UnitTestCase.newinstance
(self)

Source from the content-addressed store, hash-verified

82 nofuncargs = True
83
84 def newinstance(self):
85 class="cm"># TestCase __init__ takes the method (test) name. The TestCase
86 class="cm"># constructor treats the name class="st">"runTest" as a special no-op, so it can be
87 class="cm"># used when a dummy instance is needed. While unittest.TestCase has a
88 class="cm"># default, some subclasses omit the default (#9610), so always supply
89 class="cm"># it.
90 return self.obj(class="st">"runTest")
91
92 def collect(self) -> Iterable[Item | Collector]:
93 from unittest import TestLoader

Callers 1

collectMethod · 0.95

Calls 1

objMethod · 0.80

Tested by

no test coverage detected