You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was writing documentation for my testing suite functions, for which in a conftest.py I am defining def pytest_runtest_setup(item) to do some setup. The actual type(item) is _pytest.unittest.TestCaseFunction, which leads me to believe there is a higher type since non-unittest functions should work too. The item.__bases__ is _pytest.python.Function.
What is the "most" base type here for item (for me to add in my docs, but also look up)? The reason I am interested is because I kind of just through the setup function together blindly. For example, I check if issubclass(item.cls, MyGlobalTestCaseClass): before doing the setup, because there is some class-level data needed to do the setup. Is item.cls I can rely on? I only found item.cls by checking with debugger, but don't know if that comes from pytest or unittest.
Sorry if this question is already answered / obvious! If it is not, and there is an ideal location to put it in the docs please let me know :)
The text was updated successfully, but these errors were encountered:
GitMate.io thinks possibly related issues are #795 (Docs typo), #3145 (Understanding an IOError), #561 (SyntaxError in docs), #2435 (f), and #432 (Testing docs and doc tests).
I was writing documentation for my testing suite functions, for which in a
conftest.py
I am definingdef pytest_runtest_setup(item)
to do some setup. The actualtype(item)
is_pytest.unittest.TestCaseFunction
, which leads me to believe there is a higher type since non-unittest functions should work too. Theitem.__bases__
is_pytest.python.Function
.What is the "most" base type here for
item
(for me to add in my docs, but also look up)? The reason I am interested is because I kind of just through the setup function together blindly. For example, I checkif issubclass(item.cls, MyGlobalTestCaseClass):
before doing the setup, because there is some class-level data needed to do the setup. Isitem.cls
I can rely on? I only founditem.cls
by checking with debugger, but don't know if that comes frompytest
orunittest
.Sorry if this question is already answered / obvious! If it is not, and there is an ideal location to put it in the docs please let me know :)
The text was updated successfully, but these errors were encountered: