B
    u9a]c  ã               @   sV  d Z ddlZddlZddlmZ ddlmZmZmZmZ ddl	Z	ddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZ ddlmZ ejjrºe d¡‚ddlZdadd	„ Zd
d„ ZG dd„ dejƒZG dd„ de ƒZ!G dd„ dejƒZ"G dd„ dejƒZ#e $ej%dkd¡G dd„ dejƒƒZ&e'dkrRe (¡  dS )zTests for 'site'.

Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.

é    N)Úsupport)Úcaptured_stderrÚTESTFNÚEnvironmentVarGuardÚ
change_cwd)Úmock)ÚcopyzPython was invoked with -Sc           
   C   sz   t jd d … atjrvtj tj¡svyt tj¡ t 	tj¡ W n6 t
k
rt }  zt dtj| f ¡‚W d d } ~ X Y nX d S )Nz-unable to create user site directory (%r): %s)ÚsysÚpathÚOLD_SYS_PATHÚsiteÚENABLE_USER_SITEÚosÚisdirÚ	USER_SITEÚmakedirsÚ
addsitedirÚPermissionErrorÚunittestÚSkipTest)Úexc© r   ú/usr/lib/python3.7/test_site.pyÚsetUpModule&   s    r   c               C   s   t tjd d …< d S )N)r   r	   r
   r   r   r   r   ÚtearDownModule5   s    r   c               @   s´   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Z	de
fdd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Ze ejd¡dd„ ƒZd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(S ))ÚHelperFunctionsTestsz Tests for helper functions.
    c             C   s@   t jdd… | _tj| _tj| _tj| _	t
j| _tt
jƒ| _dS )zSave a copy of sys.pathN)r	   r
   Úsys_pathr   Ú	USER_BASEÚold_baser   Úold_siteÚPREFIXESÚold_prefixesÚ	sysconfigÚ_CONFIG_VARSÚoriginal_varsr   Úold_vars)Úselfr   r   r   ÚsetUp=   s    zHelperFunctionsTests.setUpc             C   sL   | j tjdd…< | jt_| jt_| jt_	| j
t_tj ¡  tj | j¡ dS )zRestore sys.pathN)r   r	   r
   r   r   r   r   r   r!   r    r$   r"   r#   ÚclearÚupdater%   )r&   r   r   r   ÚtearDownF   s    
zHelperFunctionsTests.tearDownc             C   sh   d}t jj|Ž }tj|Ž \}}|  t j |¡|¡ |t j |¡krP|  ||¡ n|  t j |¡|¡ d S )N)Z	BeginningZEnd)r   r
   Újoinr   ÚmakepathÚassertEqualÚabspathÚnormcase)r&   Ú
path_partsZoriginal_dirZabs_dirZnorm_dirr   r   r   Útest_makepathP   s    z"HelperFunctionsTests.test_makepathc             C   s<   t  ¡ }x.dd„ tjD ƒD ]}|  ||d||f ¡ qW d S )Nc             S   s*   g | ]"}|rt j |¡rt |¡d  ‘qS )é   )r   r
   Úexistsr   r,   )Ú.0r
   r   r   r   ú
<listcomp>_   s    z;HelperFunctionsTests.test_init_pathinfo.<locals>.<listcomp>zB%s from sys.path not found in set returned by _init_pathinfo(): %s)r   Ú_init_pathinfor	   r
   ÚassertIn)r&   Zdir_setÚentryr   r   r   Útest_init_pathinfo]   s
    z'HelperFunctionsTests.test_init_pathinfoc             C   sJ   |   |jtjd|j ¡ |   t |j¡d tj¡ |  t	j 
|j¡¡ dS )z>Contain common code for testing results of reading a .pth filez%s not in sys.modulesr   N)r7   Úimportedr	   Úmodulesr   r,   Úgood_dir_pathr
   ÚassertFalser   r3   Úbad_dir_path)r&   Úpth_filer   r   r   Úpth_file_testse   s    z#HelperFunctionsTests.pth_file_testsc             C   sL   t ƒ }|jdd z*| ¡  t |j|jtƒ ¡ |  |¡ W d | ¡  X d S )NT)Úprep)	ÚPthFileÚcleanupÚcreater   Ú
addpackageÚbase_dirÚfilenameÚsetr@   )r&   r?   r   r   r   Útest_addpackagel   s    z$HelperFunctionsTests.test_addpackageÚ.c                s\   t j |¡}|d }t j ||¡‰ tˆ ddd}|  ‡ fdd„¡ | |¡ | ¡  ||fS )Nz.pthÚwzutf-8)Úencodingc                  s
   t  ˆ ¡S )N)r   Úremover   )Úpth_fnr   r   Ú<lambda>   ó    z/HelperFunctionsTests.make_pth.<locals>.<lambda>)r   r
   r.   r+   ÚopenÚ
addCleanupÚwriteÚclose)r&   ÚcontentsÚpth_dirZpth_nameZpth_basenamer?   r   )rN   r   Úmake_pth{   s    
zHelperFunctionsTests.make_pthc          	   C   s”   |   d¡\}}tƒ }t ||tƒ ¡ W d Q R X |  | ¡ d¡ |  | ¡ t t	j
 ||¡¡¡ |  | ¡ d¡ |  | ¡ d¡ |  | ¡ d¡ d S )Nzimport bad)syntax
zline 1Ú	Tracebackzimport bad\)syntaxÚSyntaxError)rW   r   r   rE   rH   ÚassertRegexÚgetvalueÚreÚescaper   r
   r+   )r&   rV   rN   Úerr_outr   r   r   Ú!test_addpackage_import_bad_syntax†   s    
z6HelperFunctionsTests.test_addpackage_import_bad_syntaxc          	   C   s„   |   d¡\}}tƒ }t ||tƒ ¡ W d Q R X |  | ¡ d¡ |  | ¡ t t	j
 ||¡¡¡ |  | ¡ d¡ |  | ¡ d¡ d S )Nzrandompath
import nosuchmodule
zline 2rX   ÚModuleNotFoundError)rW   r   r   rE   rH   rZ   r[   r\   r]   r   r
   r+   )r&   rV   rN   r^   r   r   r   Útest_addpackage_import_bad_exec•   s    
z4HelperFunctionsTests.test_addpackage_import_bad_execc          	   C   s„   |   d¡\}}tƒ }t ||tƒ ¡ W d Q R X |  | ¡ d¡ |  | ¡ t t	j
 ||¡¡¡ |  | ¡ d¡ |  | ¡ d¡ d S )Nzabc def
zline 1rX   Ú
ValueError)rW   r   r   rE   rH   rZ   r[   r\   r]   r   r
   r+   )r&   rV   rN   r^   r   r   r   Ú#test_addpackage_import_bad_pth_file¡   s    
z8HelperFunctionsTests.test_addpackage_import_bad_pth_filec             C   sH   t ƒ }|jdd z&| ¡  t |jtƒ ¡ |  |¡ W d | ¡  X d S )NT)rA   )rB   rC   rD   r   r   rF   rH   r@   )r&   r?   r   r   r   Útest_addsitedir­   s    z$HelperFunctionsTests.test_addsitedirc             C   s   |   t ¡ t ¡ ¡ d S )N)r-   r   Ú_getuserbaser"   )r&   r   r   r   Útest__getuserbase¼   s    z&HelperFunctionsTests.test__getuserbasec             C   sB   t jdkrt jrd}n
tjd }|  t t ¡ ¡t	 
d|¡¡ d S )NÚdarwinZosx_framework_userZ_userZpurelib)r	   ÚplatformÚ
_frameworkr   Únamer-   r   Ú	_get_pathre   r"   Zget_path)r&   Zschemer   r   r   Útest_get_path¿   s
    
z"HelperFunctionsTests.test_get_pathz<requires access to PEP 370 user-site (site.ENABLE_USER_SITE)c             C   s(  t j}|  |tj¡ tj ¡ }tj	tj
dd| g|d}|  |d¡ tj ¡ }tj	tj
ddd| g|d}|t  ¡ d krˆ|  |d¡ n|  |dd¡ tj ¡ }d|d	< tj	tj
dd| g|d}|t  ¡ d krà|  |d¡ n|  |dd
¡ tj ¡ }d|d< tj	tj
ddg|d}|  |dd¡ d S )Nz-cz$import sys; sys.exit(%r in sys.path))Úenvr2   z-sr   z%User site still added to path with -sÚ1ZPYTHONNOUSERSITEz3User site still added to path with PYTHONNOUSERSITEz/tmpÚPYTHONUSERBASEz=import sys, site; sys.exit(site.USER_BASE.startswith("/tmp"))z#User base not set by PYTHONUSERBASE)r   r   r7   r	   r
   r   Úenvironr   Ú
subprocessÚcallÚ
executabler-   Úgetsitepackages)r&   Zusersiterm   Úrcr   r   r   Útest_s_optionÇ   s<    






z"HelperFunctionsTests.test_s_optionc          	   C   sh   d t _t  ¡ }|  t j|¡ d t _dd l}d |_tƒ (}d|d< |  t  ¡  d¡t  ¡ ¡ W d Q R X d S )Nr   Úxoxoro   )	r   r   Úgetuserbaser-   r"   r#   r   Ú
assertTrueÚ
startswith)r&   Ú	user_baser"   rp   r   r   r   Útest_getuserbaseð   s    z%HelperFunctionsTests.test_getuserbasec             C   sL   d t _d t _t  ¡ }|  t j|¡ |  | t j¡|¡ |  t jt  ¡ ¡ d S )N)r   r   r   Úgetusersitepackagesr-   ry   rz   rx   )r&   Ú	user_siter   r   r   Útest_getusersitepackages  s    z-HelperFunctionsTests.test_getusersitepackagesc             C   s    dgt _t  ¡ }tjdkr\|  t|ƒd¡ tj dddt	j
d d…  d¡}|  |d |¡ n@|  t|ƒd¡ |  |d d¡ tj ddd¡}|  |d |¡ d S )	Nrw   ú/r2   Úlibzpython%d.%dé   zsite-packagesr   )r   r    rt   r   Úsepr-   Úlenr
   r+   r	   Úversion_info)r&   ÚdirsZwantedr   r   r   Útest_getsitepackages  s    

z)HelperFunctionsTests.test_getsitepackagesc             C   sþ   d t _d t _tƒ h}t ddd„ ¡L |d= |d= t  ¡ }|  | dt	j
 ¡|¡ t  ¡ }|  | |¡|¡ W d Q R X W d Q R X tjddd	f}tj t d
¡L}t t dd¡2 tƒ }t  |¡ | |¡ | ¡  |  |¡ W d Q R X W d Q R X W d Q R X d S )Nzos.path.expanduserc             S   s   | S )Nr   )r
   r   r   r   rO   $  rP   z=HelperFunctionsTests.test_no_home_directory.<locals>.<lambda>ro   ÚAPPDATAú~zos.path.isdirF)Zreturn_valuer   r   T)r   r   r   r   r   Zpatchrx   ry   rz   r   rƒ   r}   Úobjectr   Z	swap_attrrH   ÚaddusersitepackagesZassert_called_once_withZassert_not_calledr=   )r&   rp   r{   r~   Z
mock_isdirZmock_addsitedirÚknown_pathsr   r   r   Útest_no_home_directory  s&    &

z+HelperFunctionsTests.test_no_home_directoryN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r'   r*   r1   r9   r@   rI   r   rW   r_   ra   rc   rd   rf   rl   r   Ú
skipUnlessr   r   rv   r|   r   r‡   r   r   r   r   r   r   9   s&   	
)
r   c               @   s4   e Zd ZdZedddfdd„Zdd„ Zdd
d„ZdS )rB   z/Helper class for handling testing of .pth filesZtimeZ__testdir__Z__badc             C   sj   |d | _ tj d¡| _tj | j| j ¡| _|| _|| _|| _	tj | j| j¡| _
tj | j| j	¡| _dS )zInitialize instance variablesz.pthÚ N)rG   r   r
   r.   rF   r+   Ú	file_pathr:   Úgood_dirnameÚbad_dirnamer<   r>   )r&   Úfilename_baser:   r•   r–   r   r   r   Ú__init__A  s    
zPthFile.__init__c             C   sr   t | jdƒ}zJtd|d td|d td| j |d t| j|d t| j|d W d| ¡  X t | j	¡ dS )ao  Create a .pth file with a comment, blank lines, an ``import
        <self.imported>``, a line with self.good_dirname, and a line with
        self.bad_dirname.

        Creation of the directory for self.good_dir_path (based off of
        self.good_dirname) is also performed.

        Make sure to call self.cleanup() to undo anything done by this method.

        rK   z#import @bad module name)ÚfileÚ
z	import %sN)
rQ   r”   Úprintr:   r•   r–   rT   r   Úmkdirr<   )r&   ÚFILEr   r   r   rD   M  s    
zPthFile.createFc             C   sŒ   t j | j¡rt  | j¡ |r@tj | j¡| _	| j	rTtj| j= n| j	rT| j	tj| j< t j | j
¡rnt  | j
¡ t j | j¡rˆt  | j¡ dS )z°Make sure that the .pth file is deleted, self.imported is not in
        sys.modules, and that both self.good_dirname and self.bad_dirname are
        not existing directories.N)r   r
   r3   r”   rM   r	   r;   Úgetr:   Zimported_moduler<   Úrmdirr>   )r&   rA   r   r   r   rC   c  s    zPthFile.cleanupN)F)rŽ   r   r   r‘   r   r˜   rD   rC   r   r   r   r   rB   >  s
   rB   c               @   s°   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Ze 	d
¡dd„ ƒZ
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zej d¡ejje ejd dkd¡e eejdƒd¡dd„ ƒƒƒƒZdS ) ÚImportSideEffectTestsz(Test side-effects from importing 'site'.c             C   s   t jdd… | _dS )zMake a copy of sys.pathN)r	   r
   r   )r&   r   r   r   r'   x  s    zImportSideEffectTests.setUpc             C   s   | j tjdd…< dS )zRestore sys.pathN)r   r	   r
   )r&   r   r   r   r*   |  s    zImportSideEffectTests.tearDownc          	   C   s‚  y"t j t j t j¡¡}t  ¡ }W n. tk
rP   t j t j t j¡¡\}}Y nX t|ƒ t j	 
¡ }||d< d}d |¡}tjtjdd|g|tjd}| ¡ \}}|  |jd¡ | ¡ d d… \}	}
|  t j |	¡¡ |  t j |
¡¡ tjtjd|g|tjd}| ¡ \}}|  |jd¡ | ¡ d d… \}	}
|  t j |	¡d	 |	 d
¡¡¡ |  t j |
¡d	 |
 d
¡¡¡ W d Q R X d S )NÚ
PYTHONPATH)zimport os, sysz9os_file = os.__file__.encode("ascii", "backslashreplace")z(sys.stdout.buffer.write(os_file + b"\n")z=os_cached = os.__cached__.encode("ascii", "backslashreplace")z*sys.stdout.buffer.write(os_cached + b"\n")rš   z-Sz-c)rm   Ústdoutr   r‚   zexpected absolute path, got {}Úascii)r   r
   ÚrelpathÚdirnameÚ__file__Úgetcwdrb   Úsplitr   rp   r   r+   rq   ÚPopenr	   rs   ÚPIPEÚcommunicater-   Ú
returncodeÚ
splitlinesr=   Úisabsry   ÚformatÚdecode)r&   ÚparentÚcwdrm   ÚcodeZcommandÚprocr¢   ÚstderrZ
os__file__Zos__cached__r   r   r   Útest_abs_paths€  s<     



z$ImportSideEffectTests.test_abs_pathsc             C   s8   t  ¡  tƒ }x$tjD ]}|  ||¡ | |¡ qW d S )N)r   ÚremoveduppathsrH   r	   r
   ÚassertNotInÚadd)r&   Z
seen_pathsr
   r   r   r   Útest_no_duplicate_paths±  s
    z-ImportSideEffectTests.test_no_duplicate_pathsztest not implementedc             C   s   d S )Nr   )r&   r   r   r   Útest_add_build_dirº  s    z(ImportSideEffectTests.test_add_build_dirc             C   s$   |   ttdƒ¡ |   ttdƒ¡ d S )NÚquitÚexit)ry   ÚhasattrÚbuiltins)r&   r   r   r   Útest_setting_quitÁ  s    z'ImportSideEffectTests.test_setting_quitc             C   s4   |   ttdƒ¡ |   ttdƒ¡ |   ttdƒ¡ d S )NÚ	copyrightÚcreditsÚlicense)ry   r¾   r¿   )r&   r   r   r   Útest_setting_copyrightÆ  s    z,ImportSideEffectTests.test_setting_copyrightc             C   s   |   ttdƒ¡ d S )NÚhelp)ry   r¾   r¿   )r&   r   r   r   Útest_setting_helpÌ  s    z'ImportSideEffectTests.test_setting_helpc             C   sR   t jdkrNdd l}| ¡ d  d¡rNx(tjj ¡ D ]}|dkr2P q2W |  d¡ d S )NÚwin32r   r2   ZcpÚmbcszdid not alias mbcs)	r	   rh   ÚlocaleÚgetdefaultlocalerz   Ú	encodingsÚaliasesÚvaluesÚfail)r&   rÉ   Úvaluer   r   r   Útest_aliasing_mbcsÐ  s    
z(ImportSideEffectTests.test_aliasing_mbcsc             C   s:   dt jkr6ydd l}W n tk
r*   Y nX |  d¡ d S )NÚsitecustomizer   z(sitecustomize not imported automatically)r	   r;   rÑ   ÚImportErrorrÎ   )r&   rÑ   r   r   r   Útest_sitecustomize_executedÚ  s    
z1ImportSideEffectTests.test_sitecustomize_executedZnetworké   Úfinalzonly for released versionsZHTTPSHandlerz$need SSL support to download licensec          
   C   s    t j ¡ d }tjj|dd}y<tj |¡& tj 	|¡}| 
¡ }W d Q R X W d Q R X W n, tjjk
r† } z
|j}W d d }~X Y nX | j|dd| d d S )Nr2   ZHEAD)ÚmethodéÈ   zCan't find )Úmsg)rÃ   Ú_Printer__datar¨   ÚurllibÚrequestZRequestÚtestr   Ztransient_internetZurlopenZgetcodeÚerrorZ	HTTPErrorr³   r-   )r&   ZurlZreqÚdatar³   Úer   r   r   Útest_license_exists_at_urlä  s    	 z0ImportSideEffectTests.test_license_exists_at_urlN)rŽ   r   r   r‘   r'   r*   r¶   rº   r   Úskipr»   rÀ   rÄ   rÆ   rÐ   rÓ   rÜ   r   Zrequires_resourceZsystem_must_validate_certr’   r	   r…   r¾   rÚ   rÛ   rà   r   r   r   r   r    u  s"   1	


r    c               @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚStartupImportTestsc          
   C   s´   t jtjddddgt jt jdd}| ¡ \}}t|ƒ}|  d|¡ dd	d
ddh}|  | 	|¡|¡ |  
d||¡ |  
d||¡ ddddddddddh
 tj¡}|  | 	|¡|¡ d S )Nz-Iz-vz-cz#import sys; print(set(sys.modules))zutf-8)r¢   rµ   rL   r   r\   Ú_sreÚsre_compileÚsre_constantsÚ	sre_parserÉ   ÚcopyregÚ_collectionsÚcollectionsÚ	functoolsÚheapqÚ	itertoolsÚkeywordÚoperatorÚreprlibÚtypesÚweakref)rq   r©   r	   rs   rª   r«   Úevalr7   r=   Úintersectionr¸   Ú
differenceÚbuiltin_module_names)r&   Úpopenr¢   rµ   r;   Zre_modsZcollection_modsr   r   r   Útest_startup_importsú  s"    
z'StartupImportTests.test_startup_importsc             C   s&   t  tjddg¡ ¡ }|  |d¡ d S )Nz-cz9import sys; sys.exit(hasattr(sys, "__interactivehook__"))z''__interactivehook__' not added by site)rq   r©   r	   rs   Úwaitry   )r&   Úrr   r   r   Útest_startup_interactivehook  s    
z/StartupImportTests.test_startup_interactivehookc             C   s(   t  tjdddg¡ ¡ }|  |d¡ d S )Nz-Iz-cz9import sys; sys.exit(hasattr(sys, "__interactivehook__"))z,'__interactivehook__' added in isolated mode)rq   r©   r	   rs   rø   r=   )r&   rù   r   r   r   Ú%test_startup_interactivehook_isolated  s    z8StartupImportTests.test_startup_interactivehook_isolatedc             C   s(   t  tjdddg¡ ¡ }|  |d¡ d S )Nz-Iz-czYimport site, sys; site.enablerlcompleter(); sys.exit(hasattr(sys, "__interactivehook__"))z6'__interactivehook__' not added by enablerlcompleter())rq   r©   r	   rs   rø   ry   )r&   rù   r   r   r   Ú.test_startup_interactivehook_isolated_explicit#  s    zAStartupImportTests.test_startup_interactivehook_isolated_explicitN)rŽ   r   r   r÷   rú   rû   rü   r   r   r   r   râ   ø  s   râ   rÇ   zonly supported on Windowsc               @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
Ú_pthFileTestsc          	   C   sŠ   t  ¡ }|  tjj|¡ tj |tj 	t
j¡d ¡}t t
j|¡ tj |¡d d }t|dƒ }x|D ]}t||d qhW W d Q R X |S )Nr2   r   z._pthrK   )r™   )ÚtempfileZmkdtemprR   rÜ   r   Zrmtreer   r
   r+   r¨   r	   rs   Úshutilr   ÚsplitextrQ   r›   )r&   ÚlinesZtemp_dirÚexe_fileZ	_pth_fileÚfÚliner   r   r   Ú_create_underpth_exe-  s    
z"_pthFileTests._create_underpth_exec             C   sH   g }x>|D ]6}|r
|d dkr q
t j t j ||¡¡}| |¡ q
W |S )Nr   ú#)r   r
   r.   r+   Úappend)r&   Ú
sys_prefixr  r   r  Zabs_pathr   r   r   Ú"_calc_sys_path_for_underpth_nosite8  s    
z0_pthFileTests._calc_sys_path_for_underpth_nositec                sÈ   t j t j tj¡¡‰ t j tj¡}d‡ fdd„tdƒD ƒd•}|  |¡}|  	t j |¡|¡}t j
 ¡ }d|d< d	 |t  d
¡¡|d
< tj|ddg|dd}| ¡  d¡}|  |d¡ |  ||d¡ d S )Núfake-path-namec                s   g | ]}ˆ ‘qS r   r   )r4   Ú_)Úlibpathr   r   r5   F  s    z;_pthFileTests.test_underpth_nosite_file.<locals>.<listcomp>r×   r“   ú	# commentzfrom-envr¡   z{};{}ÚPATHz-czCimport sys; print("\n".join(sys.path) if sys.flags.no_site else "")Úansi)rm   rL   rš   zsys.flags.no_site was Falsezsys.path is incorrect)r
  )r“   r  )r   r
   r¥   rË   r¦   r	   rs   Úranger  r	  rp   r   r¯   Úgetenvrq   Zcheck_outputÚrstripr¨   ry   r-   )r&   Ú
exe_prefixZ	pth_linesr  r   rm   ÚoutputZactual_sys_pathr   )r  r   Útest_underpth_nosite_fileA  s,     



z'_pthFileTests.test_underpth_nosite_filec          
      s¼   t j t j tj¡¡‰ t j tj¡}|  d‡ fdd„tdƒD ƒd•¡}t j |¡}t j	 
¡ }d|d	< d
 |t  d¡¡|d< tj|ddt j |d¡ˆ t j |d¡f g|d}|  |d¡ d S )Núfake-path-namec                s   g | ]}ˆ ‘qS r   r   )r4   r  )r  r   r   r5   b  s    z4_pthFileTests.test_underpth_file.<locals>.<listcomp>r×   r“   ú	# commentúimport sitezfrom-envr¡   z{};{}r  z-cz£import sys; sys.exit(not sys.flags.no_site and %r in sys.path and %r in sys.path and %r not in sys.path and all("\r" not in p and "\n" not in p for p in sys.path)))rm   zsys.path is incorrect)r  )r“   r  r  )r   r
   r¥   rË   r¦   r	   rs   r  r  rp   r   r¯   r  rq   rr   r+   ry   )r&   r  r  r  rm   ru   r   )r  r   Útest_underpth_file]  s&      
z _pthFileTests.test_underpth_fileN)rŽ   r   r   r  r	  r  r  r   r   r   r   rý   *  s   	rý   Ú__main__))r‘   r   Ztest.supportrÜ   r   r   r   r   r   r¿   r   r	   r\   rË   Zurllib.requestrÚ   Zurllib.errorrÿ   rq   r"   rþ   r   r   ÚflagsÚno_siter   r   r   r   r   ZTestCaser   rŠ   rB   r    râ   r’   rh   rý   rŽ   Úmainr   r   r   r   Ú<module>   sD   
  7 2
K
