HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/celery/contrib/__pycache__/pytest.cpython-39.pyc
a

X>hb�@s�dZddlZddlmZddlmZmZmZmZm	Z	ddl
Z
erZddlmZddl
mZneZZej�d�Zd	d
�Zed*dd
��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�dd��Ze
jdd�d d!��Ze
��d"d#��Ze
jdd�d$d%��Z e
��d&d'��Z!e
��d(d)��Z"dS)+z;Fixtures and testing utilities for :pypi:`pytest <pytest>`.�N)�contextmanager)�
TYPE_CHECKING�Any�Mapping�Sequence�Union)�Celery�)�WorkController�	NO_WORKERcCs|�dd�dS)z)Register additional pytest configuration.�markerszBcelery(**overrides): override celery configuration for a test caseN)Zaddinivalue_line)�config�r�?/usr/local/lib/python3.9/site-packages/celery/contrib/pytest.py�pytest_configures�rFckshddlm}m}|sin|}|fd||d�|��}|||d��|VWd�n1sZ0YdS)z=Utility context used to setup Celery app for pytest fixtures.�)�TestApp�setup_default_appF)Zset_as_current�enable_loggingr
)�use_trapN)Ztesting.apprr)rr�
parametersr
rrZtest_apprrr�_create_app s��r�session)ZscopecCsdS)z�You can override this fixture to enable the app trap.

    The app trap raises an exception whenever something attempts
    to use the current or default apps.
    Frrrrr�use_celery_app_trap5srccsz|j�d�}t|fi|r|jni��}tf|||d�|���*}|sR|��|��|VWd�n1sl0YdS)z1Session Fixture: Return app for session fixtures.�celery�rrrN)�node�get_closest_marker�dict�kwargsr�set_default�set_current��request�
celery_config�celery_parameters�celery_enable_loggingr�markr
Zapprrr�celery_session_app@s��r(c
cszddlm}tsv|D]}|j�|�q|D]}|�|�q*|j|fd|i|���}	|	VWd�n1sl0YdS)z?Session Fixture: Start worker that lives throughout test suite.r��worker�poolN)�testingr*r�loader�import_task_moduleZ
register_task�start_worker)
r#r(�celery_includes�celery_class_tasks�celery_worker_pool�celery_worker_parametersr*�moduleZ
class_task�wrrr�celery_session_workerTs
��r6cCsdS)z0You can override this fixture to enable logging.Frrrrrr&lsr&cCsdS)z�You can override this include modules when a worker start.

    You can have this return a list of module names to import,
    these can be task modules, modules registering signals, and so on.
    rrrrrrr0ssr0cCsdS)z�You can override this fixture to set the worker pool.

    The "solo" pool is used by default, but you can set this to
    return e.g. "prefork".
    Zsolorrrrrr2~sr2cCsiS)z�Redefine this fixture to configure the test Celery app.

    The config returned by your fixture will then be used
    to configure the :func:`celery_app` fixture.
    rrrrrr$�sr$cCsiS)z�Redefine this fixture to change the init parameters of test Celery app.

    The dict returned by your fixture will then be used
    as parameters when instantiating :class:`~celery.Celery`.
    rrrrrr%�sr%cCsiS)a"Redefine this fixture to change the init parameters of Celery workers.

    This can be used e. g. to define queues the worker will consume tasks from.

    The dict returned by your fixture will then be used
    as parameters when instantiating :class:`~celery.worker.WorkController`.
    rrrrrr3�s
r3ccsf|j�d�}t|fi|r|jni��}tf|||d�|���}|VWd�n1sX0YdS)z/Fixture creating a Celery application instance.rrN)rrrrrr"rrr�
celery_app�s��r7cCsgS)zARedefine this fixture to register tasks with the test Celery app.rrrrrr1�sr1ccsfddlm}tsb|D]}|j�|�q|j|fd|i|���}|VWd�n1sX0YdS)zAFixture: Start worker in a thread, stop it when the test returns.rr)r+N)r,r*rr-r.r/)r#r7r0r2r3r*r4r5rrr�
celery_worker�s
��r8cCs|��dS)z!Fixture that sets app as current.N)r!)r7rrr�depends_on_current_app�sr9)FFN)#�__doc__�os�
contextlibr�typingrrrrrZpytestrrr*r
�object�environ�getrrrZfixturerr(r6r&r0r2r$r%r3r7r1r8r9rrrr�<module>sR
�