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:
Ran Benita 2023-07-15 21:35:05 +03:00
parent bf451d47a1
commit a3fbf24389
1 changed files with 2 additions and 2 deletions

View File

@ -200,10 +200,10 @@ class TestCaseFunction(Function):
assert self.parent is not None
self._testcase = self.parent.obj(self.name) # type: ignore[attr-defined]
self._obj = getattr(self._testcase, self.name)
if hasattr(self, "_request"):
self._request._fillfixtures()
super().setup()
def teardown(self) -> None:
super().teardown()
if self._explicit_tearDown is not None:
self._explicit_tearDown()
self._explicit_tearDown = None