o
    Óó·i  ã                   @  s€   d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ ed	ƒZd
Zddd„ZG dd„ dejƒZdS )z*
Tests for the output generated by trial.
é    )ÚannotationsN)ÚStringIO)ÚTypeVar)Útrial)Úrunner)ÚpackagesÚ_TzNo module named 'frotz'ÚargsÚstrÚreturnc                  G  sV   ddl m} t ¡ }| | ¡ tƒ }tj|j||d d�}t 	|¡}| 
|¡ | ¡ S )Nr   )Úreporterztemp-directory)ÚstreamZworkingDirectory)Útwisted.trialr   r   ÚOptionsZparseOptionsr   r   ZTrialRunnerZVerboseTextReporterZ	_getSuiteÚrunÚgetvalue)r	   r   ÚconfigÚoutputZmyRunnerZsuite© r   údC:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\twisted/trial/test/test_output.pyÚrunTrial   s   
ý

r   c                      sÞ   e Zd ZdZd3dd„ZdZd4d	d
„Zd5dd„Zd6‡ fdd„Zd6‡ fdd„Z	d3dd„Z
d7dd„Zd7dd„Zd7dd„Zd7dd „Zd7d!d"„Zd7d#d$„Zd7d%d&„Zd7d'd(„Zd7d)d*„Zd7d+d,„Zd7d-d.„Zd7d/d0„Zd7d1d2„Z‡  ZS )8ÚImportErrorsTestszbActually run trial as if on the command line and check that the output
    is what we expect.
    r   ÚNonec                 C  s   d S ©Nr   ©Úselfr   r   r   Údebug+   s   zImportErrorsTests.debugZ_testImportErrorsr	   r
   c                 G  s   t d|  ¡ g|¢R Ž S )Nz--temp-directory)r   Úmktemp)r   r	   r   r   r   r   0   s   zImportErrorsTests.runTrialÚstuffr   c                 C  s   t |ƒ |S r   )Úprint)r   r   r   r   r   Ú_print3   s   zImportErrorsTests._printÚ	containerÚ	containeeÚobjectÚkwargsc                   ó    t ƒ j||g|¢R i |¤Ž |S r   )ÚsuperÚassertIn©r   r!   r"   r	   r$   ©Ú	__class__r   r   r'   7   ó   zImportErrorsTests.assertInc                   r%   r   )r&   ÚassertNotInr(   r)   r   r   r,   >   r+   zImportErrorsTests.assertNotInc                 C  s   |   ¡  d S r   )r   r   r   r   r   Útest_trialRunE   s   zImportErrorsTests.test_trialRunc                 C  s&   |   d¡}|  |d¡ |  |d¡ |S )Nztwisted.doesntexistú[ERROR]©r   r'   ©r   Údr   r   r   Útest_nonexistentModuleH   s   
z(ImportErrorsTests.test_nonexistentModulec                 C  ó2   |   d¡}|  |d¡ |  |d¡ |  |d¡ |S )NZdoesntexistZModuleNotFoundr.   r/   r0   r   r   r   Útest_nonexistentPackageN   ó
   
z)ImportErrorsTests.test_nonexistentPackagec                 C  r3   )Nzdoesntexist.barneyZObjectNotFoundr.   r/   r0   r   r   r   Ú!test_nonexistentPackageWithModuleU   r5   z3ImportErrorsTests.test_nonexistentPackageWithModulec                 C  ó2   |   d¡}|  |d¡ |  |d¡ |  |d¡ |S )NZ
badpackager.   ÚIOError©r   r'   r,   r0   r   r   r   Útest_badpackage\   r5   z!ImportErrorsTests.test_badpackagec                 C  r7   )Nzbadpackage.test_moduler.   r8   r9   r0   r   r   r   Útest_moduleInBadpackagec   r5   z)ImportErrorsTests.test_moduleInBadpackagec                 C  ó>   |   d¡}|  |d¡ |  |d¡ |  |d¡ |  |d¡ |S )Nzpackage.test_bad_moduler.   r8   ú<module r9   r0   r   r   r   Útest_badmodulej   ó   
z ImportErrorsTests.test_badmodulec                 C  r<   )Nzpackage.test_import_moduler.   r8   r=   r9   r0   r   r   r   Útest_badimportr   r?   z ImportErrorsTests.test_badimportc                 C  sJ   |   d¡}|  |d¡ |  |d¡ |  |d¡ |  |d¡ |  |d¡ |S )NÚpackager.   Ztest_bad_moduleZtest_import_moduler=   r8   r9   r0   r   r   r   Útest_recurseImportz   s   
z$ImportErrorsTests.test_recurseImportc                 C  sV   |   d¡}|  |d¡ |  |d¡ |  |d¡ |  |t¡ |  |d¡ |  |d¡ |S )NÚpackage2r.   Ztest_moduler=   r8   ©r   r'   Ú_noModuleErrorr,   r0   r   r   r   Útest_recurseImportErrorsƒ   s   
z*ImportErrorsTests.test_recurseImportErrorsc                 C  s4   |   dd¡}|  |d¡ |  |t¡ |  |d¡ |S )Nz-NrC   r.   r=   rD   r0   r   r   r   Útest_nonRecurseImportErrors�   s
   z-ImportErrorsTests.test_nonRecurseImportErrorsc                 C  s>   |   d¡}|  |d¡ |  |d¡ |  |d¡ |  |d¡ |S )Nzpackage.test_moduler.   r8   ÚOKúPASSED (successes=1))r   r,   r'   r0   r   r   r   Útest_regularRun”   r?   z!ImportErrorsTests.test_regularRunc                 C  óX   |   | j¡ |  tj | jdd¡¡}|  |d¡ |  |d¡ |  |d¡ |  |d¡ |S )NrA   ztest_module.pyr.   r8   rH   rI   ©	ZmangleSysPathZoldPathr   ÚosÚpathÚjoinÚparentr,   r'   r0   r   r   r   Útest_filenameœ   s   zImportErrorsTests.test_filenamec                 C  rK   )NrA   ztest_dos_module.pyr.   r8   rH   rI   rL   r0   r   r   r   Útest_dosFile¥   s   zImportErrorsTests.test_dosFile)r   r   ©r	   r
   r   r
   )r   r   r   r   )
r!   r
   r"   r
   r	   r#   r$   r#   r   r
   )r   r
   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   rP   r   r    r'   r,   r-   r2   r4   r6   r:   r;   r>   r@   rB   rF   rG   rJ   rQ   rR   Ú__classcell__r   r   r)   r   r   &   s,    












	



	r   rS   )rW   Ú
__future__r   rM   Úior   Útypingr   Ztwisted.scriptsr   r   r   Ztwisted.trial.testr   r   rE   r   ZSysPathManglingTestr   r   r   r   r   Ú<module>   s   
