File: //lib/python3/dist-packages/devscripts/test/__pycache__/test_pylint.cpython-310.pyc
o
���aN
� @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
mZ ej�
ej�e�d�Zdd� Ze�e� d �G d
d� dej��ZdS )ztest_pylint.py - Run pylint� N)�Version� )�get_source_files�unittest_verbosityzpylint.confc C s t tj�t d�kS )Nz2.11.1)r �pylint�__version__� r r �=/usr/lib/python3/dist-packages/devscripts/test/test_pylint.py�check_pylint_version s r
zpylint version not supportedc @ s e Zd ZdZdd� ZdS )�PylintTestCasez�
This unittest class provides a test that runs the pylint code check
on the Python source code. The list of source files is provided by
the get_source_files() function and pylint is purely configured via
a config file.
c C s4 t � }|�d� tjdddt dg| }t� dkr%tj�d�d� |��� t
j|t
jt
jd d
��`}|�
� \}}|jdkr�tjdd
|�� tjd��� }t�dd
|�� ��� }g }|rc|�d�|j|�� |rm|�d�|�� |sx|�d�|j�� | �d� |�� W d � dS W d � dS 1 s�w Y dS )z&Test: Run pylint on Python source code�
debootsnapz-mr z --rcfile=z--� zRunning following command:
{}
� T)�stdout�stderr� close_fdsr z%^(-+|Your code has been rated at .*)$� )�flagsz^Using config file .*
zBpylint exited with code {} and has unexpected output on stderr:
{}zpylint found issues:
{}zApylint exited with code {} and has no output on stdout or stderr.�
N)r �remove�sys�
executable�CONFIGr r �write�format�join�
subprocess�Popen�PIPE�communicate�
returncode�re�sub�decode� MULTILINE�rstrip�append�fail)�self�files�cmd�process�out�err�msgsr r r �test_pylint, s@
�
��
���"�zPylintTestCase.test_pylintN)�__name__�
__module__�__qualname__�__doc__r/ r r r r r # s r )r3 �osr! r r �unittestr �debian.debian_supportr r r r �pathr �dirname�__file__r r
�skipIf�TestCaser r r r r �<module> s