unittest: hide access to _request
Let the parent class (Function) do this. Tiny bit better abstraction. There seems to be no reason for the `hasattr` bit.
This commit is contained in:
parent
bf451d47a1
commit
a3fbf24389
|
@ -200,10 +200,10 @@ class TestCaseFunction(Function):
|
||||||
assert self.parent is not None
|
assert self.parent is not None
|
||||||
self._testcase = self.parent.obj(self.name) # type: ignore[attr-defined]
|
self._testcase = self.parent.obj(self.name) # type: ignore[attr-defined]
|
||||||
self._obj = getattr(self._testcase, self.name)
|
self._obj = getattr(self._testcase, self.name)
|
||||||
if hasattr(self, "_request"):
|
super().setup()
|
||||||
self._request._fillfixtures()
|
|
||||||
|
|
||||||
def teardown(self) -> None:
|
def teardown(self) -> None:
|
||||||
|
super().teardown()
|
||||||
if self._explicit_tearDown is not None:
|
if self._explicit_tearDown is not None:
|
||||||
self._explicit_tearDown()
|
self._explicit_tearDown()
|
||||||
self._explicit_tearDown = None
|
self._explicit_tearDown = None
|
||||||
|
|
Loading…
Reference in New Issue