| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/ |
Upload File : |
a
05d8 � @ sX d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddlm
Z
ddlmZ ddlmZ dd lm
Z
dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ e�d�Zed�Zed�Zee d d�dd��Zeed�dd�Zeeeed�dd�Zee eeef d�dd�Z!G d d!� d!�Z"e"� Z#eG d"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��MonkeyPatchNN��returnc c s 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)Zmpatch� r �7/usr/lib/python3.9/site-packages/_pytest/monkeypatch.py�monkeypatch s r )�namer c C s� | � d�}|�d�}t|�}|D ]�}|d| 7 }zt||�}W q tyP Y n0 q zt|� W nV ty� } z>t|�� � d }||kr�� ntd|� d|� ��|�W Y d }~n
d }~0 0 t|||�}q |S )N�.r ���zimport error in z: )�split�pop�
__import__�getattr�AttributeError�ImportError�str�annotated_getattr)r �parts�used�found�partZexZexpectedr r r �resolve: s&