o aN @sdZddlZddlZddlZddlZddlZddlZddlmZddl m Z m Z ej ej edZddZee d Gd d d ejZdS) ztest_pylint.py - Run pylintN)Version)get_source_filesunittest_verbosityz pylint.confcCsttjtdkS)Nz2.11.1)rpylint __version__rr=/usr/lib/python3/dist-packages/devscripts/test/test_pylint.pycheck_pylint_versionsr zpylint version not supportedc@seZdZdZddZdS)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. cCs4t}|dtjdddtdg|}tdkr%tjdd |t j |t j t j d d `}| \}}|jd krtjd d |tjd}tdd |}g}|rc|d|j||rm|d||sx|d|j|d |WddSWddS1swYdS)z&Test: Run pylint on Python source code debootsnapz-mrz --rcfile=z--zRunning following command: {}  T)stdoutstderr close_fdsrz%^(-+|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)rremovesys executableCONFIGrrwriteformatjoin subprocessPopenPIPE communicate returncoderesubdecode MULTILINErstripappendfail)selffilescmdprocessouterrmsgsrrr test_pylint,s@     "zPylintTestCase.test_pylintN)__name__ __module__ __qualname____doc__r/rrrr r #s r )r3osr!rrunittestrdebian.debian_supportrrrrpathrdirname__file__rr skipIfTestCaser rrrr s