/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
_pytest
/
/opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest
mkdir
upload
Name
Size
Mode
Actions
assertion/
-
0755
rm
config/
-
0755
rm
mark/
-
0755
rm
_code/
-
0755
rm
_io/
-
0755
rm
_py/
-
0755
rm
__pycache__/
-
0755
rm
cacheprovider.py
21392
0644
edit
dl
rm
capture.py
34737
0644
edit
dl
rm
compat.py
13200
0644
edit
dl
rm
debugging.py
13498
0644
edit
dl
rm
deprecated.py
5487
0644
edit
dl
rm
doctest.py
25961
0644
edit
dl
rm
faulthandler.py
3114
0644
edit
dl
rm
fixtures.py
67085
0644
edit
dl
rm
freeze_support.py
1339
0644
edit
dl
rm
helpconfig.py
8538
0644
edit
dl
rm
hookspec.py
32558
0644
edit
dl
rm
junitxml.py
25716
0644
edit
dl
rm
legacypath.py
16929
0644
edit
dl
rm
logging.py
34031
0644
edit
dl
rm
main.py
32491
0644
edit
dl
rm
monkeypatch.py
14857
0644
edit
dl
rm
nodes.py
26559
0644
edit
dl
rm
nose.py
1688
0644
edit
dl
rm
outcomes.py
10256
0644
edit
dl
rm
pastebin.py
3949
0644
edit
dl
rm
pathlib.py
25824
0644
edit
dl
rm
py.typed
0
0644
edit
dl
rm
pytester.py
61971
0644
edit
dl
rm
pytester_assertions.py
2327
0644
edit
dl
rm
python.py
71155
0644
edit
dl
rm
python_api.py
38400
0644
edit
dl
rm
python_path.py
709
0644
edit
dl
rm
recwarn.py
10930
0644
edit
dl
rm
reports.py
20840
0644
edit
dl
rm
runner.py
18447
0644
edit
dl
rm
scope.py
2882
0644
edit
dl
rm
setuponly.py
3261
0644
edit
dl
rm
setupplan.py
1214
0644
edit
dl
rm
skipping.py
10200
0644
edit
dl
rm
stash.py
3055
0644
edit
dl
rm
stepwise.py
4714
0644
edit
dl
rm
terminal.py
53509
0644
edit
dl
rm
threadexception.py
2915
0644
edit
dl
rm
timing.py
375
0644
edit
dl
rm
tmpdir.py
11708
0644
edit
dl
rm
unittest.py
14809
0644
edit
dl
rm
unraisableexception.py
3191
0644
edit
dl
rm
warnings.py
5070
0644
edit
dl
rm
warning_types.py
4474
0644
edit
dl
rm
_argcomplete.py
3794
0644
edit
dl
rm
_version.py
160
0644
edit
dl
rm
__init__.py
356
0644
edit
dl
rm
Edit:
/opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/unraisableexception.py
(3191B)
import sys import traceback import warnings from types import TracebackType from typing import Any from typing import Callable from typing import Generator from typing import Optional from typing import Type import pytest # Copied from cpython/Lib/test/support/__init__.py, with modifications. class catch_unraisable_exception: """Context manager catching unraisable exception using sys.unraisablehook. Storing the exception value (cm.unraisable.exc_value) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits. Storing the object (cm.unraisable.object) can resurrect it if it is set to an object which is being finalized. Exiting the context manager clears the stored object. Usage: with catch_unraisable_exception() as cm: # code creating an "unraisable exception" ... # check the unraisable exception: use cm.unraisable ... # cm.unraisable attribute no longer exists at this point # (to break a reference cycle) """ def __init__(self) -> None: self.unraisable: Optional["sys.UnraisableHookArgs"] = None self._old_hook: Optional[Callable[["sys.UnraisableHookArgs"], Any]] = None def _hook(self, unraisable: "sys.UnraisableHookArgs") -> None: # Storing unraisable.object can resurrect an object which is being # finalized. Storing unraisable.exc_value creates a reference cycle. self.unraisable = unraisable def __enter__(self) -> "catch_unraisable_exception": self._old_hook = sys.unraisablehook sys.unraisablehook = self._hook return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: assert self._old_hook is not None sys.unraisablehook = self._old_hook self._old_hook = None del self.unraisable def unraisable_exception_runtest_hook() -> Generator[None, None, None]: with catch_unraisable_exception() as cm: yield if cm.unraisable: if cm.unraisable.err_msg is not None: err_msg = cm.unraisable.err_msg else: err_msg = "Exception ignored in" msg = f"{err_msg}: {cm.unraisable.object!r}\n\n" msg += "".join( traceback.format_exception( cm.unraisable.exc_type, cm.unraisable.exc_value, cm.unraisable.exc_traceback, ) ) warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_setup() -> Generator[None, None, None]: yield from unraisable_exception_runtest_hook() @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_call() -> Generator[None, None, None]: yield from unraisable_exception_runtest_hook() @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_teardown() -> Generator[None, None, None]: yield from unraisable_exception_runtest_hook()
Save
cmd:
run