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

Method unittest_setup_class_fixture

src/_pytest/unittest.py:150–172  ·  view source on GitHub ↗
(
            request: FixtureRequest,
        )

Source from the content-addressed store, hash-verified

148 raise ExceptionGroup("Unittest class cleanup errors", exceptions)
149
150 def unittest_setup_class_fixture(
151 request: FixtureRequest,
152 ) -> Generator[None]:
153 cls = request.cls
154 if _is_skipped(cls):
155 reason = cls.__unittest_skip_why__
156 raise skip.Exception(reason, _use_item_location=True)
157 if setup is not None:
158 try:
159 setup()
160 # unittest does not call the cleanup function for every BaseException, so we
161 # follow this here.
162 except Exception:
163 cleanup()
164 process_teardown_exceptions()
165 raise
166 yield
167 try:
168 if teardown is not None:
169 teardown()
170 finally:
171 cleanup()
172 process_teardown_exceptions()
173
174 fixtures.register_fixture(
175 # Use a unique name to speed up lookup.

Callers

nothing calls this directly

Calls 3

_is_skippedFunction · 0.85
setupFunction · 0.85
cleanupFunction · 0.70

Tested by

no test coverage detected