| Server IP : 46.101.140.223 / Your IP : 216.73.217.61 Web Server : nginx/1.22.1 System : Linux debian-s-1vcpu-1gb-fra1-01 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : deploy-others ( 1001) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/_pytest/__pycache__/ |
Upload File : |
�
��c8 � �� � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddlm
Z
ddlmZ ddlmZ dd lm
Z
dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ej d� � Z ed� � Z ed� � Zede d fd�� � Zdedefd�Zdedededefd�Zdede deeef fd�Z! G d� d� � Z" e"� � Z#e G d � d!� � � � Z$dS )"z)Monkeypatching and mocking functionality.� N)�contextmanager)�Any)� Generator)�List)�MutableMapping)�Optional)�overload)�Tuple)�TypeVar)�Union)�final)�fixture)�
PytestWarningz^No module named (.*)$�K�V�return��MonkeyPatchNNc # �V K � t � � } | V � | � � � dS )a
A convenient fixture for monkey-patching.
The fixture provides these methods to modify objects, dictionaries, or
:data:`os.environ`:
* :meth:`monkeypatch.setattr(obj, name, value, raising=True) <pytest.MonkeyPatch.setattr>`
* :meth:`monkeypatch.delattr(obj, name, raising=True) <pytest.MonkeyPatch.delattr>`
* :meth:`monkeypatch.setitem(mapping, name, value) <pytest.MonkeyPatch.setitem>`
* :meth:`monkeypatch.delitem(obj, name, raising=True) <pytest.MonkeyPatch.delitem>`
* :meth:`monkeypatch.setenv(name, value, prepend=None) <pytest.MonkeyPatch.setenv>`
* :meth:`monkeypatch.delenv(name, raising=True) <pytest.MonkeyPatch.delenv>`
* :meth:`monkeypatch.syspath_prepend(path) <pytest.MonkeyPatch.syspath_prepend>`
* :meth:`monkeypatch.chdir(path) <pytest.MonkeyPatch.chdir>`
* :meth:`monkeypatch.context() <pytest.MonkeyPatch.context>`
All modifications will be undone after the requesting test function or
fixture has finished. The ``raising`` parameter determines if a :class:`KeyError`
or :class:`AttributeError` will be raised if the set/deletion operation does not have the
specified target.
To undo modifications done by the fixture in a contained scope,
use :meth:`context() <pytest.MonkeyPatch.context>`.
N)r �undo)�mpatchs �5/usr/lib/python3/dist-packages/_pytest/monkeypatch.py�monkeypatchr s+ � � � �2 �]�]�F�
�L�L�L�
�K�K�M�M�M�M�M� �namec �� � | � d� � }|� d� � }t |� � }|D ]�}|d|z z
} t ||� � }�# t $ r Y nw xY w t |� � nV# t
$ rI}t
|� � � � � d }||k r� t d|� d|� �� � |�d }~ww xY wt |||� � }��|S )N�.r ���zimport error in z: )�split�pop�
__import__�getattr�AttributeError�ImportError�str�annotated_getattr)r �parts�used�found�part�ex�expecteds r �resolver- : s � ��J�J�s�O�O�E��9�9�Q�<�<�D��t�$�$�E�� 5� 5����d�
��� ��E�4�(�(�E�
�� � � � ��D� ���� K��t������� K� K� K��2�w�w�}�}���r�*�H��4����!�"A�T�"A�"A�R�"A�"A�B�B��J����� K���� "�%��t�4�4����Ls+ �A�
A%�$A%�)A9�9
C�AC�C�obj�annc � � t | |� � } nI# t $ r<}t d� t | � � j ||� � � � |�d }~ww xY w| S )Nz'{!r} object at {} has no attribute {!r})r"