OXIESEC PANEL
- Current Dir:
/
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
_pytest
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
09/05/2025 09:34:06 AM
rwxr-xr-x
📄
__init__.py
356 bytes
12/18/2024 10:23:16 AM
rw-r--r--
📁
__pycache__
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📄
_argcomplete.py
3.71 KB
12/18/2024 10:23:16 AM
rw-r--r--
📁
_code
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📁
_io
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📁
_py
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📄
_version.py
160 bytes
12/18/2024 10:23:16 AM
rw-r--r--
📁
assertion
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📄
cacheprovider.py
20.89 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
capture.py
33.92 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
compat.py
12.89 KB
12/18/2024 10:23:16 AM
rw-r--r--
📁
config
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📄
debugging.py
13.18 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
deprecated.py
5.36 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
doctest.py
25.35 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
faulthandler.py
3.04 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
fixtures.py
65.51 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
freeze_support.py
1.31 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
helpconfig.py
8.34 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
hookspec.py
31.79 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
junitxml.py
25.11 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
legacypath.py
16.53 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
logging.py
33.23 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
main.py
31.73 KB
12/18/2024 10:23:16 AM
rw-r--r--
📁
mark
-
02/07/2025 10:01:29 PM
rwxr-xr-x
📄
monkeypatch.py
14.51 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
nodes.py
25.94 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
nose.py
1.65 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
outcomes.py
10.02 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
pastebin.py
3.86 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
pathlib.py
25.22 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
py.typed
0 bytes
12/18/2024 10:23:16 AM
rw-r--r--
📄
pytester.py
60.52 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
pytester_assertions.py
2.27 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
python.py
69.49 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
python_api.py
37.5 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
python_path.py
709 bytes
12/18/2024 10:23:16 AM
rw-r--r--
📄
recwarn.py
10.67 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
reports.py
20.35 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
runner.py
18.01 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
scope.py
2.81 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
setuponly.py
3.18 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
setupplan.py
1.19 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
skipping.py
9.96 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
stash.py
2.98 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
stepwise.py
4.6 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
terminal.py
52.25 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
threadexception.py
2.85 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
timing.py
375 bytes
12/18/2024 10:23:16 AM
rw-r--r--
📄
tmpdir.py
11.43 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
unittest.py
14.46 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
unraisableexception.py
3.12 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
warning_types.py
4.37 KB
12/18/2024 10:23:16 AM
rw-r--r--
📄
warnings.py
4.95 KB
12/18/2024 10:23:16 AM
rw-r--r--
Editing: warnings.py
Close
import sys import warnings from contextlib import contextmanager from typing import Generator from typing import Optional from typing import TYPE_CHECKING import pytest from _pytest.config import apply_warning_filters from _pytest.config import Config from _pytest.config import parse_warning_filter from _pytest.main import Session from _pytest.nodes import Item from _pytest.terminal import TerminalReporter if TYPE_CHECKING: from typing_extensions import Literal def pytest_configure(config: Config) -> None: config.addinivalue_line( "markers", "filterwarnings(warning): add a warning filter to the given test. " "see https://docs.pytest.org/en/stable/how-to/capture-warnings.html#pytest-mark-filterwarnings ", ) @contextmanager def catch_warnings_for_item( config: Config, ihook, when: "Literal['config', 'collect', 'runtest']", item: Optional[Item], ) -> Generator[None, None, None]: """Context manager that catches warnings generated in the contained execution block. ``item`` can be None if we are not in the context of an item execution. Each warning captured triggers the ``pytest_warning_recorded`` hook. """ config_filters = config.getini("filterwarnings") cmdline_filters = config.known_args_namespace.pythonwarnings or [] with warnings.catch_warnings(record=True) as log: # mypy can't infer that record=True means log is not None; help it. assert log is not None if not sys.warnoptions: # If user is not explicitly configuring warning filters, show deprecation warnings by default (#2908). warnings.filterwarnings("always", category=DeprecationWarning) warnings.filterwarnings("always", category=PendingDeprecationWarning) apply_warning_filters(config_filters, cmdline_filters) # apply filters from "filterwarnings" marks nodeid = "" if item is None else item.nodeid if item is not None: for mark in item.iter_markers(name="filterwarnings"): for arg in mark.args: warnings.filterwarnings(*parse_warning_filter(arg, escape=False)) yield for warning_message in log: ihook.pytest_warning_recorded.call_historic( kwargs=dict( warning_message=warning_message, nodeid=nodeid, when=when, location=None, ) ) def warning_record_to_str(warning_message: warnings.WarningMessage) -> str: """Convert a warnings.WarningMessage to a string.""" warn_msg = warning_message.message msg = warnings.formatwarning( str(warn_msg), warning_message.category, warning_message.filename, warning_message.lineno, warning_message.line, ) if warning_message.source is not None: try: import tracemalloc except ImportError: pass else: tb = tracemalloc.get_object_traceback(warning_message.source) if tb is not None: formatted_tb = "\n".join(tb.format()) # Use a leading new line to better separate the (large) output # from the traceback to the previous warning text. msg += f"\nObject allocated at:\n{formatted_tb}" else: # No need for a leading new line. url = "https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings" msg += "Enable tracemalloc to get traceback where the object was allocated.\n" msg += f"See {url} for more info." return msg @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_protocol(item: Item) -> Generator[None, None, None]: with catch_warnings_for_item( config=item.config, ihook=item.ihook, when="runtest", item=item ): yield @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_collection(session: Session) -> Generator[None, None, None]: config = session.config with catch_warnings_for_item( config=config, ihook=config.hook, when="collect", item=None ): yield @pytest.hookimpl(hookwrapper=True) def pytest_terminal_summary( terminalreporter: TerminalReporter, ) -> Generator[None, None, None]: config = terminalreporter.config with catch_warnings_for_item( config=config, ihook=config.hook, when="config", item=None ): yield @pytest.hookimpl(hookwrapper=True) def pytest_sessionfinish(session: Session) -> Generator[None, None, None]: config = session.config with catch_warnings_for_item( config=config, ihook=config.hook, when="config", item=None ): yield @pytest.hookimpl(hookwrapper=True) def pytest_load_initial_conftests( early_config: "Config", ) -> Generator[None, None, None]: with catch_warnings_for_item( config=early_config, ihook=early_config.hook, when="config", item=None ): yield