| Server IP : 65.1.209.187 / Your IP : 216.73.216.144 Web Server : nginx/1.24.0 System : Linux ip-172-31-5-206 6.14.0-1015-aws #15~24.04.1-Ubuntu SMP Tue Sep 23 22:44:48 UTC 2025 x86_64 User : ( 1001) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/twisted/application/runner/test/__pycache__/ |
Upload File : |
�
oj]2 � �| � d Z ddlZddlmZ ddlmZmZ ddlm Z m
Z
mZ ddlm
Z
ddlmZ ddlZddlmZ dd lmZ dd
lmZ ddlmZ d
dlmZmZmZmZmZmZmZ de
de f de
de f fd�Z G d� dej@ jB jD � Z# G d� dej@ jB jD � Z$y)z3
Tests for L{twisted.application.runner._pidfile}.
� N)�wraps)�getpid�name)�Any�Callable�Optional)�verifyObject)�NoReturn)�FilePath)�platform)�SkipTest� )�_pidfile� )�AlreadyRunningError�InvalidPIDFileError�IPIDFile�NonePIDFile�
NoPIDFound�PIDFile�StalePIDFileError�f.�returnc �` � � t � � dt dt dt dt f� fd�� }|S )a=
Decorator for tests that are not expected to work on all platforms.
Calling L{PIDFile.isRunning} currently raises L{NotImplementedError} on
non-POSIX platforms.
On an unsupported platform, we expect to see any test that calls
L{PIDFile.isRunning} to raise either L{NotImplementedError}, L{SkipTest},
or C{self.failureException}.
(C{self.failureException} may occur in a test that checks for a specific
exception but it gets NotImplementedError instead.)
@param f: The test method to decorate.
@return: The wrapped callable.
�self�args�kwargsr c � �� t j � dk( }|r �| g|��i |��S | j t t | j
f�| g|��i |��}t
|t � r*| j t |� j d� � y y )N�posixz isRunning is not implemented on )
r �getType�assertRaises�NotImplementedErrorr
�failureException�
isinstance�
assertTrue�str�
startswith)r r r � supported�er s ��N/usr/lib/python3/dist-packages/twisted/application/runner/test/test_pidfile.py�wrapperz$ifPlatformSupported.<locals>.wrapper3 s� �� ��$�$�&�'�1� ���T�+�D�+�F�+�+�!��!�!�$�h��0E�0E�F���� � �
��A� �!�0�1�����A�� 1� 1�2T� U�V� 2� )r r )r r+ s ` r* �ifPlatformSupportedr- ! sD �� �$ �1�X�W�c� W�#� W�� W�� W� �W� �Nr, c �& � e Zd ZdZddee dee fd�Zdd�Z dd�Z
dd�Zdd �Zdd
�Z
dd�Zdd�Zdd
�Zdd�Zdd�Zdd�Zedd�� Zedd�� Zedd�� Zedd�� Zedd�� Zedd�� Zdd�Zdd�Zedd�� Zedd�� Zy)�PIDFileTestsz
Tests for L{PIDFile}.
N�contentr c �^ � t | j � � }|�|j |� |S �N)r �mktemp�
setContent)r r0 �filePaths r* r5 zPIDFileTests.filePathL s+ � ��D�K�K�M�*��������(��r, c �V � t | j � � }t t |� y)z5
L{PIDFile} conforms to L{IPIDFile}.
N)r r5 r r �r �pidFiles r* �test_interfacezPIDFileTests.test_interfaceR s � � �$�-�-�/�*���X�w�'r, c �P � | j t j d�� d� y)zR
L{PIDFile._format} returns the expected format when given a PID.
�9 ��pids 1337
N)�assertEqualr �_format)r s r* �test_formatWithPIDzPIDFileTests.test_formatWithPIDY s � �
������T�2�I�>r, c � � d}t | j t j |�� � � }| j ||j � � y)zK
L{PIDFile.read} returns the PID from the given file path.
r; r<