File: //lib/python3/dist-packages/twisted/application/runner/test/__pycache__/test_pidfile.cpython-38.pyc
U
W[�2 � @ s� d Z ddlmZ ddlZddlmZmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ dd lmZ d
dlmZ dd
lmZmZmZmZmZmZmZ ddlZddlmZ dd� ZG dd� dejj j!�Z"G dd� dejj j!�Z#ee�G dd� de$��Z%dS )z3
Tests for L{twisted.application.runner._pidfile}.
� ��wrapsN)�getpid�name)�BytesIO)�implementer)�verifyObject)� IFilePath)�platform� )�_pidfile� )�IPIDFile�PIDFile�NonePIDFile�AlreadyRunningError�InvalidPIDFileError�StalePIDFileError�
NoPIDFound)�SkipTestc s t � �� fdd��}|S )aQ
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.
@type f: method
@return: The wrapped callable.
c s` t �� dk}|r � | f|�|�S | jtt| jf� | f|�|�}t|t�r\| �t|�� d�� d S )N�posixz isRunning is not implemented on )
r
ZgetType�assertRaises�NotImplementedErrorr ZfailureException�
isinstance�
assertTrue�str�
startswith)�self�args�kwargsZ supported�e��f� �N/usr/lib/python3/dist-packages/twisted/application/runner/test/test_pidfile.py�wrapper0 s
���
�z$ifPlatformSupported.<locals>.wrapperr )r"