403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.42
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python315/Lib/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python315/Lib/test/__pycache__/test_shutil.cpython-315.opt-1.pyc
R
>lqjgWc���]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PHs]PH s]PH$s	]PH(s
]PH,s]PH0s]PH4s
]PH8s]QHGsGsGsGsGsGsGsGsGsGsGsGs]PHls]PHps]PHvs]QH|G s ]QH�G"s"]QH�G$s$G%s%\$Q*s&\$Q*s'\$Q*s(\OROUQ2s+\OROUQ	2s,\ORQ
*Q6Hs-]PH�s.]PH�s/P	s0]PH�s1\OdOgQ\4Q
2Q5s5Qs6Qs7Q@Qks8Qs9QAQks:Qs;Qs<\<2s=Qs>QQ2s?QQ\?\O�2sAQQ\?\O�2sBQQ\?\O�2sCQQ \?\O�2sDQ!Q"\?\O�2sE\ O�2Q#Q$\?\O�22sGQ%Q&\G2sHQ'Q(\?\O�2sIQ)Q*\O�2sJQ+Q,\O�2sKQ-Q.\L2sMQ/Q0\M2sN\O�\=%(Q12\OdOfO�\Q2P
2Q3Q4\N\O�222sP\O�\O�Q52Q6Q7\N\O�22sS\O�\+%(Q82Q9Q:\M\O�22sTQ;Q<\O�2sUQ=Q>\O�2sV\WQ?6Xc\O�2P!P!\cPsCK�h9h\cP
s0CKrh9h\cPs1CK}h9h)B�)�make_archive�register_archive_format�unregister_archive_format�get_archive_formats�Error�unpack_archive�register_unpack_format�
RegistryError�unregister_unpack_format�get_unpack_formats�
SameFileError�_GiveupOnFastCopy)�support)�	os_helper)�TESTFN�FakePath�2�_SRC�_DST�darwin�sunos:N�N�aixzos.chdirzshouldn't call os.chdir()��side_effectc�:�[[[Q]2Q2g)�EXDEVzInvalid cross-device link)�OSError�getattr�errno)�args�kwargss*,�%C:\Python315\\Lib\test\test_shutil.py�_fake_renamer#8s��
�'�%��"�-�/J�
K�K�c�H`�[OR2U1Qk2oU!)c�:�[Oo[[mRU-U@U[m!W[mh9h�N)�os�renamer#)r r!�builtin_rename�funcs*, �r"�wrap�mock_rename.<locals>.wrap=s4���	'��Y�Y�N�$�B�I���(��(�&�B�I���B�I�s	�'7�
A)�	functools�wraps)r+r,sf r"�mock_renamer0<s%����_�_�T��'��'��Kr$c�B�[U[2%c [OOUo[U[
2%cUO
2o[UQ29^tt^2oUOU2PPP2P!)%fhP!9h)z�Write *content* to a file located at *path*.

If *path* is a tuple instead of a string, os.path.join will be used to
make a path.
�xb)	�
isinstance�tupler(�path�join�str�encode�open�write)r5�content�fps&& r"�create_filer=Gsf���$�����w�w�|�|�T�"���'�3����.�.�"��	
�d�D�	�	�R�
�����
�	�	�	�s�1B
�
B	�B	c	��Qo[UQ2oQO[U2Tt,tFD5o[O[
O2O2MJ7	to2o[UQ29^tt^2oUV2FDoUOU2J	PPP2P!ttoh)%fhP!9h)zBCreate a test file with an arbitrary size and random text content.c3�X �V6�cUw�	V*oJU%cUw�	P!P!3hr'�)�total�steps&&r"�chunks�write_test_file.<locals>.chunksVs#����l��J��M�E���K��s�*�*�	*i r$�wb)
�minr6�range�random�choice�string�
ascii_lettersr8r9r:)r5�sizerC�bufsize�i�chunk�f�csizes&&      r"�write_test_filerRTs�����$��o�G��H�H�$�W�~�/�-�!��m�m�F�$8�$8�9�@�@�B�-�/�
0�E�	
�d�D�	�	�Q��D�*�E�
�G�G�E�N�+�
�	��/�	�	�	�s�=B,�"B1�1C	�:C	c�&�[U[2%c [OOUoU%cQLQoU%cPLQo[VUQ59^tt^2oUO
2ttPPP2!)%fhP!9h)z�Return contents from a file located at *path*.

If *path* is a tuple instead of a string, os.path.join will be used to
make a path.  If *binary* is true, the file will be opened in binary
mode.
�rb�r�utf-8��encoding)r3r4r(r5r6r9�read)r5�binary�moderXr<s&&   r"�	read_filer\fs\���$�����w�w�|�|�T�"���4�s�D��t�7�H�	
�d�8�	,�	,���w�w�y�
-�	,�	,�	,�s�$A?�?B	�B	c���,o[[OU22FD�o[OO	V2o[OOU2%cr[OO
U2%fMUOUQ*2[U2FD"oUOUQ*U*2J$	J�UOU2J�	U!)�/)	�sortedr(�listdirr5r6�isdir�islink�append�rlistdir)r5�res�name�p�ns&    r"rdrdts���
�C��r�z�z�$�'�(���G�G�L�L��$��
�7�7�=�=����B�G�G�N�N�1�$5�$5��J�J�t�c�z�"��a�[���
�
�4�#�:��>�*�!�
�J�J�t��)��Jr$c
��[[Q2%fP
!PoPo[OQ[O2P
Q59^tt^2oUO
oUO
Q2PPP2[UQ29^tt^2o[OQ[O2P
Q59^tt^2oUO
oUO2oUO2o[OVe]]2PPP2PPP2Ud[OU2Ud[OU2P	!P	!)%fhK�9h[cKPPP2PPP2Sd[OS2Sd[OS2P
!P
!h9h)%fhL9hPPP2L)%fhL9hSd[OS2Sd[OS2P!P!Sd[OS2Sd[OS2hh9h)�sendfilerE��dir�deletes
0123456789rT)
�hasattrr(�tempfile�NamedTemporaryFile�getcwdrfr:r9�filenorjr�unlinkr)�srcname�dstnamerP�src�dst�infd�outfds       r"�supports_file2file_sendfilerz�s����2�z�"�"���G��G�&�
�
(�
(��2�9�9�;�u�
M�
M�QR��f�f�G�
�G�G�M�"�N��'�4�
 �
 �C��,�,�T�r�y�y�{�5�Q�Q�UX��(�(���z�z�|���
�
��� ��K�K��Q��2� �R�!������W�%������W�%��%N�
M���!� �R�!������W�%������W�%��!��
R�Q��Q�!�
 �
 �
 �������W�%������W�%��������W�%������W�%��s��4H$�E�1H$�
5G�-F<	�0E$�F<	�	G�H$�E!	�E!	�H$�$	F9�.F9�/F<	�0G�8H$�8F9�9F<	�<G
�G
�G�	H$�G)	�"G)	�$H$�$I�)I�Ic��[%c}[OQ6Xch[OQ[O
*2oUO
Q2P*O
2]*o[U]2Q6�!P	!)i���z/usr/bin/dump -o %s�
i )�AIX�sys�maxsize�
subprocess�	getoutput�
executable�split�int)�hdrs�maxdatas  r"�
_maxdataOKr��sa��
�s�s�{�{�j�(�
�
!�
!�"7�#�.�.�"H�
I���
�
�4� ��$�*�*�,�Q�/���7�2��*�,�,�r$c�,`�\sQs]�snQQksQsUsP!)�BaseTestc��[OU[O2Q5oUO	[
OU2U!)zZCreate a temporary directory that will be cleaned up.

Returns the path of the directory.
)�prefixrl)ro�mkdtempr(rq�
addCleanupr�rmtree)�selfr��ds&& r"r��BaseTest.mkdtemp�s5��

���F��	�	��<�����	�(�(�!�,��r$r@r')�__name__�
__module__�__qualname__�__firstlineno__r��__static_attributes__�__classdictcell__��
__classdict__s@r"r�r��s�����r$r�c�`�\sQs]�snQs\OQ2s\OQ2s\OQ2s	\
O\Q2Q2s
\
O\Q2Q2s\
O\Q2Q2sQ	sQ
sQs\
O&\O*Q*Q
6HQ2\O,\O.Q222sQs\
O&\O*Q*Q
6HQ2\O,\O.Q222sQs\
O&\O*Q*Q
6HQ2\O,\O.Q222sQsQs\
O\O@OBQ2Q2s"\
O\O@OBQ2Q2s#\
O&\O@OBQ2Q2s$Qs%\OQ2s&\
O\Q2Q2s'\
O\(\)Q2Q 2\
O&\O*Q!6HQ"2Q#22s*\
O&\O*Q*Q
6HQ2\O,\O.Q$222s+Q%s,Q&s-Us.P!)'�
TestRmTreec�l�UO2o[OOUQ2o[OU2[[OOUQ2Q2[OU2oUOU[2[OU2P!)�killme�somefile�foo)r�r(r5r6�mkdirr=�fsencode�assertIsInstance�bytes�shutilr�)r��tmp�victims&  r"�test_rmtree_works_on_bytes�%TestRmTree.test_rmtree_works_on_bytes�sp���l�l�n�������c�8�,��
������B�G�G�L�L���4�e�<����V�$�����f�e�,��
�
�f�r$c�~`�UO2o[OOUQ2o[OU2[OOUQ2o[O
V#2UO
[[OU2UO[OOU22UO[OOU22,nU1Qko[OV4Q5UO[R2]2UOR]*]*[OO 2UOR]*]*U2UO#R]*]*]*[2P!)rl�linkc�,:�ROU2P!r'�rc�r �errorss*�r"�onerror�@TestRmTree.test_rmtree_fails_on_symlink_onerror.<locals>.onerror������M�M�$�r$�r��r�r(r5r6r��symlink�assertRaisesrr�r��
assertTrue�exists�lexists�assertEqual�len�assertIsrbr��r�r��dir_r�r�r�s&    @r"�$test_rmtree_fails_on_symlink_onerror�/TestRmTree.test_rmtree_fails_on_symlink_onerror�s����l�l�n���w�w�|�|�C��'��
������w�w�|�|�C��(��
�
�
�4�����'�6�=�=�$�7���������t�,�-����������-�.���	 ��
�
�d�,�����V��a�(��
�
�f�Q�i��l�B�G�G�N�N�3�������1��t�,����f�Q�i��l�1�o�w�7r$c�p`�UO2o[OOUQ2o[OU2[OOUQ2o[O
V#2UO
[[OU2UO[OOU22UO[OOU22,nU1Qko[OV4Q5UO[R2]2UOR]*]*[OO 2UOR]*]*U2UO#R]*]*[2P!)rlr�c�,:�ROU2P!r'r�r�s*�r"�onexc�<TestRmTree.test_rmtree_fails_on_symlink_onexc.<locals>.onexc�r�r$�r�r��r�r�r�r�r�r�s&    @r"�"test_rmtree_fails_on_symlink_onexc�-TestRmTree.test_rmtree_fails_on_symlink_onexc�s
����l�l�n���w�w�|�|�C��'��
������w�w�|�|�C��(��
�
�
�4�����'�6�=�=�$�7���������t�,�-����������-�.���	 ��
�
�d�(�����V��a�(��
�
�f�Q�i��l�B�G�G�N�N�3�������1��t�,����f�Q�i��l�G�4r$c��UO2o[OOUQ2o[OOUQ2o[OOUQ2oV#U1FDo[OU2J	[OOUQ2o[UQ2[OOUQ2o[OV72[OOUQ2o[OVH2[OOUQ2o	[OVi2[OU2UO[OOU22UO[OOU22UO[OOU22P!��dir1�dir2�dir3�file1r��link1�link2�link3)r�r(r5r6r�r=r�r�r��assertFalser�r��
r�r�r�r�r�r�r�r�r�r�s
&         r"�test_rmtree_works_on_symlinks�(TestRmTree.test_rmtree_works_on_symlinks�s:���l�l�n���w�w�|�|�C��(���w�w�|�|�D�&�)���w�w�|�|�C��(���T�!�A��H�H�Q�K�"������S�'�*���E�5�!������T�7�+��
�
�
�4�������T�7�+��
�
�
�4�������T�7�+��
�
�
�5� ��
�
�d�����������-�.���������t�,�-���������u�-�.r$zonly relevant on Windowsc�`�UO2o[OOUQ2o[OU2[OOUQ2o[
OV#2UO[OU2UO[[OU2UO[OOU22UO[OO!U22,nU1Qko[OV4Q5UO#[%R2]2UO'R]*]*[OO(2UO#R]*]*U2UO+R]*]*]*[2P!)rlr�c�,:�ROU2P!r'r�r�s*�r"r��BTestRmTree.test_rmtree_fails_on_junctions_onerror.<locals>.onerrorr�r$r��r�r(r5r6r��_winapi�CreateJunctionr�rrsr�rr�r�r�r�r�r�r�r�rbr�r�s&    @r"�&test_rmtree_fails_on_junctions_onerror�1TestRmTree.test_rmtree_fails_on_junctions_onerror�s'����l�l�n���w�w�|�|�C��'��
������w�w�|�|�C��(�����t�*����	�(�(�$�/����'�6�=�=�$�7���������t�,�-����������-�.���	 ��
�
�d�,�����V��a�(��
�
�f�Q�i��l�B�G�G�N�N�3�������1��t�,����f�Q�i��l�1�o�w�7r$c�`�UO2o[OOUQ2o[OU2[OOUQ2o[
OV#2UO[OU2UO[[OU2UO[OOU22UO[OO!U22,nU1Qko[OV4Q5UO#[%R2]2UO'R]*]*[OO(2UO#R]*]*U2UO+R]*]*[2P!)rlr�c�,:�ROU2P!r'r�r�s*�r"r��>TestRmTree.test_rmtree_fails_on_junctions_onexc.<locals>.onexcr�r$r�r�r�s&    @r"�$test_rmtree_fails_on_junctions_onexc�/TestRmTree.test_rmtree_fails_on_junctions_onexcs#����l�l�n���w�w�|�|�C��'��
������w�w�|�|�C��(�����t�*����	�(�(�$�/����'�6�=�=�$�7���������t�,�-����������-�.���	 ��
�
�d�(�����V��a�(��
�
�f�Q�i��l�B�G�G�N�N�3�������1��t�,����f�Q�i��l�G�4r$c��UO2o[OOUQ2o[OOUQ2o[OOUQ2oV#U1FDo[OU2J	[OOUQ2o[UQ2[OOUQ2o[OV72[OOUQ2o[OVH2[OOUQ2o	[OVi2[OU2UO[OOU22UO[OOU22UO[OOU22P!r�)
r�r(r5r6r�r=r�r�r�r�r�r�r�r�s
&         r"�test_rmtree_works_on_junctions�)TestRmTree.test_rmtree_works_on_junctions's@���l�l�n���w�w�|�|�C��(���w�w�|�|�D�&�)���w�w�|�|�C��(���T�!�A��H�H�Q�K�"������S�'�*���E�5�!������T�7�+�����t�+������T�7�+�����t�+������T�7�+�����u�,��
�
�d�����������-�.���������t�,�-���������u�-�.r$c�>�[OUO2Q5oUO[[
OU2[
OUP	Q5UO2o[OOUQ2o[U2UO[29^tt^2o[
OU2PPP2UOWOOU2UO[OO!U22[
OUP	Q5UO[OO!U22UO["[
OP2UO["[
OPP	Q5[
OO$%c["L[&oUOU29^tt^2[
OUQQ5PPP2UOU29^tt^2[
OUQP	Q5PPP2P!)%fhCK�9h)%fhKa9h)%fhP!9h)�rl��
ignore_errors�tstfile�invalid��dir_fd)r�r�)ro�mktempr�r��FileNotFoundErrorr�r�r(r5r6r=�NotADirectoryErrorr��	exception�filenamer�r��	TypeError�avoids_symlink_attacks�NotImplementedError)r�r��tmpdir�cm�excs&    r"�test_rmtree_errors�TestRmTree.test_rmtree_errors=s����?�?�t�|�|�~�6�����+�V�]�]�H�E��
�
�h�d�3�������7�7�<�<��	�2���H��
�
�
�1�
2�
2�b��M�M�(�#�3�������.�.��9���������x�0�1��
�
�h�d�3���������x�0�1����)�V�]�]�D�9����)�V�]�]�D���M�!�=�=�?�?�?�i�EX��
�
�
�s�
#�
#��M�M�(�9�5�$�
�
�
�s�
#�
#��M�M�(�9�D�I�$�
#�3�
2�
2��$�
#��
#�
#�
#�s6�<I$�I8�J�$I5	�-I5	�8J	�J	�J	�J	c�`�UO2o[OOUQ2o[	U2,nU1Qko[
OV#Q5UO[R2]2UOR]*]*[O2UOR]*]*U2UOR]*]*]*[2UOR]*]*]*OU2UOR]*]*[O2UOR]*]*U2UOR]*]*]*[2UOR]*]*]*OU2P!)r�c�,:�ROU2P!r'r�r�s*�r"r��6TestRmTree.test_rmtree_errors_onerror.<locals>.onerror]r�r$r��r�r(r5r6r=r�r�r�r�r��scandirr�r�r��rmdir)r�r�r�r�r�s&   @r"�test_rmtree_errors_onerror�%TestRmTree.test_rmtree_errors_onerrorXs6���������7�7�<�<��	�2���H����	 ��
�
�h�0�����V��a�(��
�
�f�Q�i��l�B�J�J�/�������1��x�0����f�Q�i��l�1�o�/A�B�������1��a��1�1�8�<��
�
�f�Q�i��l�B�H�H�-�������1��x�0����f�Q�i��l�1�o�/A�B�������1��a��1�1�8�<r$c�d`�UO2o[OOUQ2o[	U2,nU1Qko[
OV#Q5UO[R2]2UOR]*]*[O2UOR]*]*U2UOR]*]*[2UOR]*]*OU2UOR]*]*[O2UOR]*]*U2UOR]*]*[2UOR]*]*OU2P!)r�c�,:�ROU2P!r'r�r�s*�r"r��2TestRmTree.test_rmtree_errors_onexc.<locals>.onexcor�r$r�r�)r�r�r�r�r�s&   @r"�test_rmtree_errors_onexc�#TestRmTree.test_rmtree_errors_onexcjs&���������7�7�<�<��	�2���H����	 ��
�
�h�,�����V��a�(��
�
�f�Q�i��l�B�J�J�/�������1��x�0����f�Q�i��l�,>�?�������1��.�.��9��
�
�f�Q�i��l�B�H�H�-�������1��x�0����f�Q�i��l�,>�?�������1��.�.��9r$:N�N�cygwinz2This test can't be run on Cygwin (issue #1071513).c�&�]Um[O[2UO	[
O[2[OO[Q2Um	[OO[Q2Um
[OUO2[OUO2[O[2Oo[OUO2Oo[OUO2Oo[O[O *o[O"UOU2[O"UOU2[O"[U2UO	[O"[U2UO	[O"UOU2UO	[O"UOU2[
O[UO$Q5UO'UO]Q2P!)r�a�br�z1Expected call to onerror function did not happen.)�
errorStater(r�rr�r�r�r5r6�child_file_path�child_dir_pathr�create_empty_file�stat�st_mode�S_IREAD�S_IEXEC�chmod�check_args_to_onerrorr��r��old_dir_mode�old_child_file_mode�old_child_dir_mode�new_modes&    r"�
test_on_error�TestRmTree.test_on_error|s���
���
���������
�
�v�.�!�w�w�|�|�F�C�8��� �g�g�l�l�6�3�7����#�#�D�$8�$8�9�
����$�$�%��w�w�v��.�.�� �g�g�d�&:�&:�;�C�C���W�W�T�%8�%8�9�A�A���<�<����,��
����%�%�x�0�
����$�$�h�/�
�����"�������&�,�7�������$�"6�"6�8K�L�������$�"5�"5�7I�J��
�
�f�d�&@�&@�A�������!�L�	Nr$c��UO]6c�U[OIcUOV O2LrU[O
IcUOV O2LBUOU[O2UOU[UO,2UOU]*[2U9O]*
tmP!UOU[O
2UOU[2UOU]*[2]UmP!��)
rr(rsr�r
r�rr�r`�assertInr�assertIsSubclassr�r�r+�argr�s&&&&r"r� TestRmTree.check_args_to_onerror�s����?�?�Q���r�y�y� �� � ��&:�&:�;�����!�� � ��&9�&9�:��
�
�d�B�J�J�/��
�
�c�F�D�,?�,?�#@�A��!�!�#�a�&�'�2��O�O�q� �O����T�2�8�8�,����S�&�)��!�!�#�a�&�'�2��D�Or$c�&�]Um[O[2UO	[
O[2[OO[Q2Um	[OO[Q2Um
[OUO2[OUO2[O[2Oo[OUO2Oo[OUO2Oo[O[O *o[O"UOU2[O"UOU2[O"[U2UO	[O"[U2UO	[O"UOU2UO	[O"UOU2[
O[UO$Q5UO'UO]Q2P!)rr
rr�z/Expected call to onexc function did not happen.)rr(r�rr�r�r�r5r6r
rrrrrrrr�check_args_to_onexcr�rs&    r"�test_on_exc�TestRmTree.test_on_exc�s���
���
���������
�
�v�.�!�w�w�|�|�F�C�8��� �g�g�l�l�6�3�7����#�#�D�$8�$8�9�
����$�$�%��w�w�v��.�.�� �g�g�d�&:�&:�;�C�C���W�W�T�%8�%8�9�A�A���<�<����,��
����%�%�x�0�
����$�$�h�/�
�����"�������&�,�7�������$�"6�"6�8K�L�������$�"5�"5�7I�J��
�
�f�D�$<�$<�=�������!�J�	Lr$c��UO]6c�U[OIcUOV O2LrU[O
IcUOV O2LBUOU[O2UOU[UO,2UO[U[22U9O]*
tmP!UOU[O
2UOU[2UO[U[22]UmP!r)rr(rsr�r
r�rr�r`r rr�r3rr"s&&&&r"r&�TestRmTree.check_args_to_onexc�s����?�?�Q���r�y�y� �� � ��&:�&:�;�����!�� � ��&9�&9�:��
�
�d�B�J�J�/��
�
�c�F�D�,?�,?�#@�A��O�O�J�s�G�4�5��O�O�q� �O����T�2�8�8�,����S�&�)��O�O�J�s�G�4�5��D�Or$c�2``�P
nP
nU1QkoU1Qko[O[2UO[O
[2[OO[Q2Um[OO[Q2Um	[OUO2[OUO2[O[2Oo[OUO2Oo[OUO2Oo[O[O*o[O UOU2[O UOU2[O [U2UO[O [U2UO[O UOU2UO[O UOU2[O
[VQ5UO#R2UO%R2P!)Fc�:�P	nP!�Tr@)r �onerror_calleds*�r"r��7TestRmTree.test_both_onerror_and_onexc.<locals>.onerror�s���!�Nr$c�:�P	nP!r-r@)r �onexc_calleds*�r"r��5TestRmTree.test_both_onerror_and_onexc.<locals>.onexc�s����Lr$r
r)r�r�)r(r�rr�r�r�r5r6r
rrrrrrrrr�r�)	r�r�r�rrrrr.r1s	&      @@r"�test_both_onerror_and_onexc�&TestRmTree.test_both_onerror_and_onexc�s����
����	"�	 �	���������
�
�v�.�!�w�w�|�|�F�C�8��� �g�g�l�l�6�3�7����#�#�D�$8�$8�9�
����$�$�%��w�w�v��.�.�� �g�g�d�&:�&:�;�C�C���W�W�T�%8�%8�9�A�A���<�<����,��
����%�%�x�0�
����$�$�h�/�
�����"�������&�,�7�������$�"6�"6�8K�L�������$�"5�"5�7I�J��
�
�f�g�;�����%�����(r$c�`�[OnU1QkoU[m[O[2[	[Q1Q2[
O[2R[mP!R[mh9h)c�@:�U[6wc[2gRU2!r')rr)�fnr r!�
orig_lstats&*,�r"�raiser�FTestRmTree.test_rmtree_does_not_choke_on_failing_lstat.<locals>.raisers�����<�!�)�O�%�b�>�)r$r�)r(�lstatr�rr=r�r�)r�r9r8s& @r"�+test_rmtree_does_not_choke_on_failing_lstat�6TestRmTree.test_rmtree_does_not_choke_on_failing_lstatsT���
	"����J�
*�
�B�H��H�H�V�������/��M�M�&�!�!�B�H��z�B�H�s�A'A8�8
Bc�j`�[O[O[O[O.[O
6*9%cK[O[O79%c"[O[O7oU%c�UO[OO2UO2o[OOUQ2o[O U2[OoQQ["2nU1QkoU[mUO%R[OU2U[mP!UO'[OO2P!W[mh9h)r
c��\sQsQsQsP!)�HTestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>.Called�4r@)r�r�r�r�r�r@r$r"�Calledr@4s��r$rBc�
:�Rgr'r@)r r!rBs*,�r"�_raiser�ITestRmTree.test_rmtree_uses_safe_fd_version_if_available.<locals>._raiser5s��� �Lr$)r(r9rrsr��supports_dir_fdr`�supports_fd�supports_follow_symlinksr�r�r�r�r�r5r6r��	Exceptionr�r�)r��_use_fd_functions�tmp_dirr��	real_openrDrBs&     @r"�-test_rmtree_uses_safe_fd_version_if_available�8TestRmTree.test_rmtree_uses_safe_fd_version_if_available(s��� �g�g�r�w�w��	�	�2�8�8�D��/�/�0�D�D��Z�Z�2�>�>�9�D�D� �W�W��(C�(C�C�	���O�O�F�M�M�@�@�A��l�l�n�G������W�c�*�A��H�H�Q�K�
$��G�G�	�-�Y�-�!�!����!�!�&�&�-�-��;�#������V�]�]�A�A�B��$���s
�AF%�%
F2zrequires safe rmtreec	��```�UO2o[OOUQ2o[OU2[OOUQ2o[OU2UU1Qko]n[
O[QU29^tt^2nUO[29^tt^2[OU2PPP2PPP2UO[OOU22UOR]2]n,nU1Qko[
O[QU29^tt^2n[OV%Q5PPP2UO[R2]2UOR]*]*U2UOR]*]*U2UOR]*]*U2UOR]*]*U2UOR]2P!)%fhCKV9h)%fhCKb9h)%fhK�9h)r�r�c�4:�RU2R]*
n[g)��r)�fd�close_count�
orig_closes&��r"�close�4TestRmTree.test_rmtree_fails_on_close.<locals>.closeGs����r�N��1��K��Mr$rVc�,:�ROU2P!r'r�r�s*�r"r��4TestRmTree.test_rmtree_fails_on_close.<locals>.onexcVr�r$r�)r�r(r5r6r�r�	swap_attrr�rr�r�r�rar�r�r�)	r�r�r�r�rVr�rTr�rUs	&     @@@r"�test_rmtree_fails_on_close�%TestRmTree.test_rmtree_fails_on_close>s�����l�l�n���w�w�|�|�C��(��
������w�w�|�|�D�&�)��
�����	���
�
�
�r�7�E�
2�
2�j��"�"�7�+�+��
�
�d�#�,�3�	
������
�
�d�+�,�����a�(�����	 �
�
�
�r�7�E�
2�
2�j��M�M�$�,�3�����V��a�(��
�
�f�Q�i��l�E�*�������1��t�,��
�
�f�Q�i��l�E�*�������1��t�,�����a�(�!,�+�+��3�
2�
2��3�
2�sB�.I�H0	�#I�!I�0I
�9I
�;	I�I	�
I	�I(	�!I(	zdir_fd is not supportedc���UO2oQo[OOV2o[OU[O
2oUO
[OU2[OU2[O[OOUQ22[[OOUQQ2Q2UO[OOU22[OV$Q5UO[OOU22P!)r��subdirr�r�r�)r�r(r5r6r9�O_RDONLYr�rVr�r=r�r�r�r�r�)r�rKr��fullnamer�s&    r"�test_rmtree_with_dir_fd�"TestRmTree.test_rmtree_with_dir_fdas����,�,�.�����7�7�<�<��0������"�+�+�.��������&�)�
�����
��������h��1�2��B�G�G�L�L��8�Z�@�%�H���������x�0�1��
�
�f�,����������1�2r$zdir_fd is supportedc�&�UO2oUO[29^tt^2[OU]Q5PPP2UO[OOU22P!)%fhK@9h)rr�)	r�r�r�r�r�r�r(r5r�)r�rKs& r"�#test_rmtree_with_dir_fd_unsupported�.TestRmTree.test_rmtree_with_dir_fd_unsupportedosT���,�,�.��
�
�
�2�
3�
3��M�M�'�!�,�4���������w�/�0�4�
3�s�B�B	�	B	c��[OUO2Q5vq[OU2UO[[OU2[OU2P!�r�)
ro�mkstempr�r(rVr�r�r�r��remove)r��handler5s&  r"�test_rmtree_dont_delete_file�'TestRmTree.test_rmtree_dont_delete_filevsH���'�'�D�L�L�N�;���
��������,�f�m�m�T�B�
�	�	�$�r$c��[O[2[OO	[Q2o[OO	[Q2o[OU2[O
V2UO
[[OU2[OUP	Q5[O[P	Q5P![O[P	Q5h9h)�cheese�shopr�)
r(r�rr5r6r�r�rr�r��r�rvrws&  r"�test_rmtree_on_symlink�!TestRmTree.test_rmtree_on_symlink}s���	�����	6��'�'�,�,�v�x�0�C��'�'�,�,�v�v�.�C��H�H�S�M��J�J�s� ����g�v�}�}�c�:��M�M�#�T�2��M�M�&��5��F�M�M�&��5�s�B1C,�,D
c�l�[O[2[OO	[Q2o[OO	[Q2o[OU2[[OO	UQ22[OV2UO[[OU2[OUP	Q5[O[P	Q5P![O[P	Q5h9h)rnro�spamr�)r(r�rr5r6r=r�r�r�rr�r�rps&  r"�test_rmtree_on_junction�"TestRmTree.test_rmtree_on_junction�s���
�����		6��'�'�,�,�v�x�0�C��'�'�,�,�v�v�.�C��H�H�S�M�������S�&�1�2��"�"�3�,����g�v�}�}�c�:��M�M�#�T�2��M�M�&��5��F�M�M�&��5�s�CD�D3�mkfifo�requires os.mkfifo()�vxworks�%fifo requires special path on VxWorksc��[O[2UO[29^tt^2[
O[2PPP2UO[OO[22[O[2[O[2[O[OO[Q22[
O[2UOO[22P!)%fhK�9h[O[2h9h)N�mypipe)r(rwrr�r�r�r�r�r5r�rsr�r6r��r�s&r"�test_rmtree_on_named_pipe�$TestRmTree.test_rmtree_on_named_pipe�s���	�	�	�&��	��"�"�#5�6�6��
�
�f�%�7��O�O�B�G�G�N�N�6�2�3��I�I�f��
�����
�	�	�"�'�'�,�,�v�x�0�1��
�
�f�����������/�0�7�6��
�I�I�f��s(�E�E	�:E�	E	�E	�E�E8c
�````	�UUUU	1Qko[O[2[,[]2Tt,tFD*o[OO[QU02MJ,	to*n	R	Q*nR	Q*nRFDo[OU2J	RFDo[
U2J	R	Tt,tFD#o[OU2OMJ%	ton[O[O*o[R	2FDo[OV42J	[O[UQ5P!ttohttoh[R	R2FD.vq5[OX52J[ cJ,h9h	[O[2g9h)c�:`�[U[2%fg[R	R2FDvq4[OV42J	[U1QkR22oRFD!oV56wfJ[OU2J#	[U1QkR22oRFD!oV56wfJ[OU2J#	P!)c3�D:�SF �DpR6wfJUw�	J	P!3hr'r@��.0rgr5s& �r"�	<genexpr>�PTestRmTree.test_rmtree_deleted_race_condition.<locals>._onexc.<locals>.<genexpr>�s��4���4�a��9���4��� � c3�D:�SF �DpR6wfJUw�	J	P!3hr'r@r�s& �r"r�r��s��5���5�a��I���5�r�)r3�PermissionError�zipr(r�nextr�rs)
r7r5r�rgr[�keep�dirs�files�	old_modes�pathss
&f&   ����r"�_onexc�=TestRmTree.test_rmtree_deleted_race_condition.<locals>._onexc�s�����c�?�3�3���u�i�0�������!�1��5�4�5�5�D����9��H�H�Q�K���6�5�6�6�D����9��I�I�a�L�r$�child:rQNr:rNrr�)r(r�rrGr5r6r=rrrr�reversedrr�r�r�r)
r�r�rNr5rr[r�r�r�r�s
&     @@@@r"�"test_rmtree_deleted_race_condition�-TestRmTree.test_rmtree_deleted_race_condition�sQ���	!�	!�$	�������%*�1�X�/�%-���G�G�L�L��5����=�%-�/�/���T�{���d����D��H�H�T�N���D�����8=�=�u�t�R�W�W�T�]�*�*�u�=�	��<�<����,���U�O�D��H�H�T�$�$�
	��M�M�&��/��#/��>��	�!�%��3�
����H�H�T�(�������4�

�M�M�&�!��sA�2E�+E �=E%�%G�:F�G�	F!	�F!	�G� F!	�! Gc�R�](oU]
*o[OO[,Q,U*N3o[OU2[
OU29^tt^2[O[2PPP2P!)%fhP!9h)�(r�)	r(r5r6r�makedirsr�infinite_recursionr�r�)r��recursion_limit�directory_depth�bases&   r"�!test_rmtree_above_recursion_limit�,TestRmTree.test_rmtree_above_recursion_limit�sg����)�B�.���w�w�|�|�F�?�s�e�o�&=�?��
���D��
�
'�
'��
8�
8��M�M�&�!�9�
8�
8�
8�s�0B�B&	�B&	)rr
r)/r�r�r�r�r�r�skip_unless_symlinkr�r�r��unittest�
skipUnlessr�r�r�r�r�rr�skipIfr~�platform�skip_if_dac_override�skip_unless_working_chmodrrr'r&r3r<rMr�r�r�r[rardrkrqrurnr(r~r�r�r�r�r�s@r"r�r��s;������"�"�8�#�8�$�"�"�5�#�5�$�"�"�/�#�/�*����"<�=�8�>�8�&����"<�=�5�>�5�&����"<�=�/�>�/�*J�6=�$:�$�_�_�S�\�\�"�%��1�I�K��#�#��(�(�N�)�$�K�N�6 �6�_�_�S�\�\�"�%��1�I�K��#�#��(�(�L�)�$�K�L�6 �6�_�_�S�\�\�"�%��1�I�K��#�#��(�(�")�)�$�K�")�H"� C�,������=�=�?U�V� )�W� )�D������=�=�?X�Y�3�Z�3��_�_�V�]�]�9�9�;P�Q�1�R�1���"�"�6�#�6�����"<�=�6�>�6������X�.�0F�G�
�_�_�S�\�\�Y�.�;�=�1�=�H�1��_�_�S�\�\�"�%��1�I�K��#�#��(�(�3�)�$�K�3�j"�"r$r�c�`�\sQsQsnQsQs\OQ2sQs	Qs
Qs\OOQ2Q	2sQ
s\O"\\Q2Q2\O\O(\O,Q
6HQ2Q222sQs\OQ2s\OQ2sQsQsQsUsP!)�TestCopyTree��c	�T�UO2o[OOUO2Q2oUO	[
OU2UO	[
O[OOU22[UQ1Q2[O[OOUQ22[UQQ1Q2[
OV2UO[OO[OOUQ222UO[OO[OOUQ222UO[OO[OOUQQ222[UQ12oUOUQ2[UQQ12oUOUQ2P!)�destination�test.txt�123�test_dir�456)r�r(r5r6r�r�r��dirnamer=r��copytreer��isfilerar\r��r��src_dir�dst_dir�actuals&   r"�test_copytree_simple�!TestCopyTree.test_copytree_simple�sc���,�,�.���'�'�,�,�t�|�|�~�}�=������
�
�w�/�����
�
�r�w�w���w�'?�@��W�j�)�5�1�
��������g�z�2�3��W�j�*�5�u�=�����)���������r�w�w�|�|�G�Z�'H�I�J�������
�
�b�g�g�l�l�7�J�&G�H�I���������r�w�w�|�|�G�Z�4>�(@�A�	B��G�Z�0�1�������'��G�Z��<�=�������'r$c	��UO2oUO2oUO[OU2UO[OU2[	UQ1Q2[
O[
OOUQ22[
O[
OOUQ22[	UQQ1Q2[	UQQ1Q2[OVP	Q5UO[
OO[
OOUQ222UO[
OO[
OOUQ222UO[
OO[
OOUQQ222[UQ12oUOUQ2[UQQ12oUOUQ2UO[ 29^tt^2[OVP
Q5PPP2P!)%fhP!9h)znonexisting.txtr��existing_dirzexisting.txtzwill be replacedzhas been replaced)�
dirs_exist_ok)r�r�r�r�r=r(r�r5r6r�r�r�rar\r�r��FileExistsErrorr�s&   r"�test_copytree_dirs_exist_ok�(TestCopyTree.test_copytree_dirs_exist_oks����,�,�.���,�,�.������
�
�w�/�����
�
�w�/��W�/�0�%�8�
��������g�~�6�7�
��������g�~�6�7��W�n�n�=�?Q�R��W�n�n�=�?R�S������=���������r�w�w�|�|�G�=N�'O�P�Q�������
�
�b�g�g�l�l�7�N�&K�L�M���������r�w�w�|�|�G�^�4B�(D�E�	F��G�%6�7�8�������'��G�^�^�D�E������!4�5�
�
�
��
/�
/��O�O�G�E�B�0�
/�
/�
/�s�I2�2J	�;J	c	���UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OU2[OU2[UQ1Q2[OOUQ2o[OOUQ2o[O[OOUQ2U2[[Q2%c;[OU[O[O*2[[Q2%c<[[Q	2%c&[OU[O2[OU2o[O V#P	Q
5UO#[OO%[OOUQQ222[O&[OOUQQ22o[O(Q6Xc!UO+Q2%c
UQ
*oUO-U[OOUQ22[OU2o	[[Q2%c'UO-U	O.UO.2[[Q2%c)UO-U	O0UO02P!P!)rvrw�subzfile.txtr�r�zsub/link�lchmod�lchflags�	UF_NODUMP��symlinks�ntz\\?\:�NN)r�r(r5r6r�r=r�rnr�r�S_IRWXU�S_IRWXOr�r�r;r�r�r�rb�readlinkrf�
startswithr�r�st_flags)
r�rKr�r��sub_dir�src_link�dst_link�src_statr��dst_stats
&         r"�test_copytree_symlinks�#TestCopyTree.test_copytree_symlinkss���,�,�.���'�'�,�,�w��.���'�'�,�,�w��.���'�'�,�,�w��.��
�����
������W�j�)�5�1��7�7�<�<���0���7�7�<�<���4��
�
�
�2�7�7�<�<���4��	��2�x� � ��I�I�h����t�|�|� ;�<��2�z�"�"�w�t�[�'A�'A��K�K��$�.�.�1��8�8�H�%������4�8���������r�w�w�|�|�G�U�F�'K�L�M����R�W�W�\�\�'�5�&�A�B���7�7�d�?�v�0�0��;�;��B�Z�F����������g�z�!B�C��8�8�H�%���2�x� � ����X�-�-�x�/?�/?�@��2�z�"�"����X�.�.��0A�0A�B�#r$c
��[OOo[OOoUO	2oUUO	2Q2o[UQ1Q2[UQ1Q2[OUUQ22[UQQ1Q2[OUUQ22[UQQ1Q2[OUUQQ22[OUUQQ22[UQQQ1Q2[UQQQ	1Q2[OQ
Q2o[OV4UQ5UOUUUQ222UOUUUQ222UOUUUQ222[OU2[OQ
Q2o[OV4UQ5UOUUUQ222UOUUUQQ222UOUUUQQ222[OU2Q
o[OV4UQ5UOUUUQQQ	222UOUUUQQ222[OU2[OU2[O[OOU22P![OS2h9h[OS2h9h[OS2h9h[OS2[O[OOW22h9h)r�r�r�ztest.tmpr�r��	test_dir2r^�subdir2ztest.pyz*.tmp��ignorezsubdir*c��,oSFD�o[OOV2o[OOU2%c0UO	2P*Q6XcUOU2Jv[OO
U2P*Q7fJ�UOU2J�	U!)rQr^z.py)r(r5r6rar�rc�splitext)rv�namesrerfr5s&&   r"�_filter�8TestCopyTree.test_copytree_with_exclude.<locals>._filterds����C� %��!�w�w�|�|�C�6���G�G�M�M�$�/�/� �J�J�L��,��8��J�J�t�,��W�W�-�-�d�3�B�7�E�B��J�J�t�,�!&��Jr$)r(r5r6r�r�r=r�r��ignore_patternsr�r�r�r�r�)r�r6r�r�r��patternsr�s&      r"�test_copytree_with_exclude�'TestCopyTree.test_copytree_with_exclude<s����w�w�|�|���������,�,�.��:	4��4�<�<�>�=�9�G���*�-�u�5���*�-�u�5��H�H�T�'�:�.�/���*�j�9�5�A��H�H�T�'�;�/�0���+�z�:�E�B��H�H�T�'�;��9�:��H�H�T�'�;�	�:�;���+�x��D�e�L���+�y�)�D�e�L�
'�!�1�1�'�;�G�������B�����t�G�Z�'@� A�B�� � ���W�j�(A�!B�C�� � ���W�k�(B�!C�D��
�
�g�&�
'�!�1�1�'�9�E�������B�� � ���W�j�(A�!B�C�� � ���W�k�9�(M�!N�O�� � ���W�k�8�(L�!M�N��
�
�g�&�
'�
������A�� � ���W�k�9�-6�)8�"9�:�� � ���W�k�8�(L�!M�N��
�
�g�&��M�M�'�"��M�M�"�'�'�/�/�'�2�3��I�
�
�g�&���
�
�g�&��0�
�
�g�&���M�M�'�"��M�M�"�'�'�/�/�'�2�3�sY�C'M>�/B	L-�8M>�BM�M>�1AM#�M>�-M�M>�M � M>�#M;�;M>�>AO	c
�b``�[OOo[OOoRO	2oUUQ2o[O
UU22[O
UUQ22[O
[OOUQQ22[
UQQQ1Q2,nUU1QkoURO	2Q2o[OVFUQ5ROUUUQQQ222URO	2Q2o[O[U2VeQ5ROUUUQQQ222URO	2Q2o[[OU22]*oROU[O2[OVvUQ5ROUUUQQQ222RO[!R2]	2P!)�sourcer�r^r�r�c�:�ROU2ROU[2ROU[2RO	[U2[[
U222SFDoROU[2J	,!r')rcr�r7�listr�r��set)rvr�rf�invocationsr�s&& ��r"�_ignore�?TestCopyTree.test_copytree_arg_types_of_ignore.<locals>._ignore�sl������s�#��!�!�#�s�+��!�!�%��.����S��Z��S��Z��9����%�%�d�C�0���Ir$r�r�)r(r5r6r�r�r�r=r�r�r�rr�r�r��DirEntryr�r�)	r�r6r�rKr�r�r��
src_dir_entryr�s	f       @r"�!test_copytree_arg_types_of_ignore�.TestCopyTree.test_copytree_arg_types_of_ignore}s�����w�w�|�|���������,�,�.���w��)��
����g���
����g�z�*�+�
��������g�z�8�<�=��W�j�(�J�?��G���	��t�|�|�~�}�5�������9�����t�G�Z��$.� 0�1�	2��t�|�|�~�}�5�������)�7�C�����t�G�Z��$.� 0�1�	2��t�|�|�~�}�5���R�Z�Z��0�1�!�4�
����m�R�[�[�9����
�w�?�����t�G�Z��$.� 0�1�	2�	
����[�)�1�-r$c	��UO2o[OOUQ2o[OU2[OOUQ2oUO[OU2[OUQ2[UQ1Q2[O[OOUQ2Q2[UQ1Q2[O[OOUQ2Q2[OUQ5oUO[OU2[OUQ2[OV#2UO[OU2O[OU2O2UO[O[OOUQ22O[O[OOUQ22O2UO[O[OOUQ22O[O[OOUQ22O2[OOU[OO!U2]*2oUO[OU2O[OU2O2P!)	r�r��zpermissive.txtr�zrestrictive.txtr��r�)r�r(r5r6r�r�r�r�rr=rorr�r�rrr�)r�rKr�r��restrictive_subdir�restrictive_subdir_dsts&     r"�!test_copytree_retains_permissions�.TestCopyTree.test_copytree_retains_permissions�s1���,�,�.���'�'�,�,�w��1��
������'�'�,�,�w�
�6������
�
�w�/�
����%� ��W�.�/��7�
��������g�'7�8�%�@��W�/�0�%�8�
��������g�'8�9�5�A�%�-�-�'�:�����	�(�(�*<�=�
���#�U�+�����)��������)�1�1�2�7�7�7�3C�3K�3K�L������������g�7G�!H�I�Q�Q��'�'�"�'�'�,�,�w�8H�"I�J�R�R�	T������������g�7H�!I�J�R�R��'�'�"�'�'�,�,�w�8I�"J�K�S�S�	U�!#�����g�.0�g�g�m�m�<N�.O�PQ�.R�"T��������!3�4�<�<��'�'�"8�9�A�A�	Cr$zos.chmodc��UO2o[OOUO2Q2oUO	[
OU2UO	[
O[OOU22[Q2Um	UO[
O29^tt^2[
OV#2PPP2P!)%fhP!9h)r�zka-boom)
r�r(r5r6r�r�r�r�r�rr�rr�)r��
mock_patchr�r�s&&  r"�test_copytree_winerror�#TestCopyTree.test_copytree_winerror�s���
�,�,�.���'�'�,�,�t�|�|�~�}�=������
�
�w�/�����
�
�r�w�w���w�'?�@�!0��!;�
��
�
�
�v�|�|�
,�
,��O�O�G�-�-�
,�
,�
,�s�C5�5D	�>D	c�J````�UUUU1Qko,nRO2n[ORO2Q5n[[O
O
RQ22[ORRUQ5RO[R2]2P!)c�D:�ROP2ROU[2ROU[2ROU[O
O
RQ22ROU[O
O
RQ22P!)Nr�)rcr�r7r�r(r5r6)r
rrw�flagr�rvs&&����r"�custom_cpfun�ETestCopyTree.test_copytree_custom_copy_function.<locals>.custom_cpfun�sm����K�K����!�!�!�S�)��!�!�!�S�)����Q������S�%� 8�9����Q������S�%� 8�9r$r�r���
copy_function)r�ror�r=r(r5r6r�r�r�r�)r�r�rwr�rvsf @@@r"�"test_copytree_custom_copy_function�/TestCopyTree.test_copytree_custom_copy_function�sn���	:�	:����l�l�n���o�o�$�,�,�.�1���B�G�G�L�L��e�,�-�����S��=�����T��A�&r$rwrxryrzc��[O[2[OO	[Q2o[OU2[OO	UQ2o[O
U2[O[[2UOQ2[O [P	Q5[O [P	Q5P![c#oSOQS*2Po=K�Po=hh9h[Oc^oSO]*oSO[S2]2S]*vqVoSOQS*S2Po=K�Po=hh9h[O [P	Q5[O [P	Q5h9h)r^r|�os.mkfifo(): %sz$shutil.Error should have been raisedz`%s` is a named piper�)r(r�rr5r6rwr��skipTestr�r��TESTFN2�failrr r�r�r�)r�r^�pipe�er�rvrw�	error_msgs&       r"�test_copytree_named_pipe�%TestCopyTree.test_copytree_named_pipe�s=��
	�����	7��W�W�\�\�&�(�3�F��H�H�V���7�7�<�<���1�D�
5��	�	�$��
B������0��	�	�@�A��M�M�&��5��M�M�'��6��#�
5��
�
�/�!�3�4�4��
5���<�<�
K�������� � ��V��a�0�&,�Q�i�#��)�� � �!7�$�!>�	�J�J��	
K��
�M�M�&��5��M�M�'��6�sg�AF�8C9�D)�.F�9	D&�D&�D!�F�!D&�&F�)F�=F�>AF�F�F�F�:Gc�`�UO2o[OOUO2Q2o[	UQ1Q2[O
[OOUQ22[	UQQ1Q2,nU1Qko[OVUQ5UO[R2]2P!)r�r�r�r�r�c�.:�ROV12P!r'r�)rvrw�copieds&&�r"�_copy�6TestCopyTree.test_copytree_special_func.<locals>._copys����M�M�3�*�%r$r�)
r�r(r5r6r=r�r�r�r�r�)r�r�r�rrs&   @r"�test_copytree_special_func�'TestCopyTree.test_copytree_special_func�s�����,�,�.���'�'�,�,�t�|�|�~�}�=���W�j�)�5�1�
��������g�z�2�3��W�j�*�5�u�=���	&�	�����>�����V��a�(r$c	�j�UO2o[OOUQ2o[	UQ2[OOUQ2o[O
U2V1FDmo[OQ[OOUQ22[OU[OOUQ22Jo	[OOUO2Q2oUO[[OV2[OOUO2Q2o[OVP	Q5[OU2FD*vqgoUOQU2UOQU2J,	[OOUO2Q	2o[OVP	Q
5UOQ[OU22P!)r��abc�dir_a�
IDONTEXIST�broken�validr��destination2)�ignore_dangling_symlinks�destination3r�)r�r(r5r6r=r�r�r�rr�r��walk�assertNotInr r`)	r�r��
valid_filerr�r��rootr�r�s	&        r"�test_copytree_dangling_symlinks�,TestCopyTree.test_copytree_dangling_symlinks
sc���,�,�.���W�W�\�\�'�:�6�
��J��&������W�g�.��
�������A��J�J�|�R�W�W�\�\�!�X�%>�?��J�J�z�2�7�7�<�<��7�#;�<� �
�'�'�,�,�t�|�|�~�}�=�����%����'�C��'�'�,�,�t�|�|�~�~�>������4�H�!#����!1��D�����X�u�-��M�M�'�5�)�"2�
�'�'�,�,�t�|�|�~�~�>������4�8��
�
�j�"�*�*�W�"5�6r$c	���UO2o[OOUO2Q2o[O[OOUQ22[[OOUQQ22[O[OOUQ2[OOUQ2P	Q5[OVP
Q5UO[OO[OOUQ222UOQ[O[OOUQ222[OOUO2Q2o[OVP	Q5UO[OO[OOUQ222UOQ[O[OOUQ222P!)r��real_dirr��link_to_dir��target_is_directoryr�r)r�r(r5r6r�r=r�r�r�r�rbr r`r�)r�r�r�s&  r"�test_copytree_symlink_dir�&TestCopyTree.test_copytree_symlink_dir%sc���,�,�.���'�'�,�,�t�|�|�~�}�=��
��������g�z�2�3��B�G�G�L�L��*�j�A�B�
�
�
�2�7�7�<�<���4��7�7�<�<���7�'+�	-�	����5�9��������������W�m�(L�M�N��
�
�j�"�*�*�R�W�W�\�\�'�=�-Q�"R�S��'�'�,�,�t�|�|�~�~�>������4�8���������r�w�w�|�|�G�]�'K�L�M��
�
�j�"�*�*�R�W�W�\�\�'�=�-Q�"R�Sr$c�N�UO2oUQ*oUO[OUP	2[O
O
UQ2o[UQ2[OV2oUOQ,[OU22P!)�destr�)r�r�r�r�r(r5r6r=r�r�r`)r�r�r�rv�rvs&    r"�test_copytree_return_value�'TestCopyTree.test_copytree_return_value8sq���,�,�.���F�"������
�
�w��5��g�g�l�l�7�E�*���C���
�_�_�W�
.�����%��"�*�*�R�.�1r$c���UO2oUO[OUP	Q5[O
O
UQQ2o[O
O
UQQ2o[OU2[O
O
UQ2o[UQ2[OV#2oUOQ,[OU22P!)Tr��t�pg�
somevendorz1.0�pol)r�r�r�r�r(r5r6r�r=r�r�r`)r��base_dirr�r�rvr+s&     r"�test_copytree_subdirectory�'TestCopyTree.test_copytree_subdirectoryBs����<�<�>������
�
�x�t��D��'�'�,�,�x��d�3���'�'�,�,�w��e�<��
���G���g�g�l�l�7�E�*���C���
�_�_�W�
.�����%��"�*�*�R�.�1r$r@)r�r�r�r�r�r�rr�r�r�r�r�r��mock�patchr�rr�rnr(r�r~r�r
rr r'r,r4r�r�r�s@r"r�r��s����(�&C�2�"�"�C�#�C�>?4�B(.�TC�6�]�]����$�.�%�.�'�"�����X�.�0F�G��"�"�
�_�_�S�\�\�Y�.�;�=�7�=�#�H�7�.)��"�"�7�#�7�4�"�"�T�#�T�$2�
2�
2r$r�c�`�\sQsQsn\O
Q2s\O\	\
Q2Q2\O
Q22s\O\	\
Q2Q2\O
Q22s
\O
Q2s\O\	\
Q	29%c\	\Q
29%c
\	\Q2Q2Q
2s\O"Q2s\O
\O"\O&Q222sQsQs\O
Q2s\O\	\
Q2Q2Q2s\O
Q2s\O"Q2sQsQsQsQs\O
Q2s\O\	\
Q2Q2Q2s \O
Q 2s!\O\	\
Q!2Q"2\O\"OFQ#6HQ$2Q%22s$Q&s%Q's&\O\'9%f
\(9%f\)Q(2\O\*Q)2Q*22s+Q+s,Q,s-Us.P!)-�TestCopyiNc��UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[	UQ2[O
V$2[O
V52[OU[O[O*2[OU[O2UO[OU2O[OU2O2[OV#2UO[OU2O[OU2O2[OU[O2[OVC2UO[OU2O[OU2O2[OU[O2[OV%2UO[OU2O[OU2O2[OU[O2[OVE2UO[OU2O[OU2O2P!)r��bar�baz�quux)r�r(r5r6r=r�rrr��S_IRWXGr��assertNotEqualrr��copymoder��r�rKrvrwr�r�s&     r"�test_copymode_follow_symlinks�&TestCopy.test_copymode_follow_symlinksRs����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���7�7�<�<���0���C����C���
�
�
�3�!�
�
�
�3�!�
����d�l�l�4�<�<�/�0�
����d�l�l�#����B�G�G�C�L�0�0�"�'�'�#�,�2F�2F�G�����!���������-�-�r�w�w�s�|�/C�/C�D�	����d�l�l�#�����&���������-�-�r�w�w�s�|�/C�/C�D�
����d�l�l�#�����&���������-�-�r�w�w�s�|�/C�/C�D�
����d�l�l�#�����+���������-�-�r�w�w�s�|�/C�/C�Dr$r�zrequires os.lchmodc���UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[	UQ2[O
V$2[O
V52[OU[O[O*2[OU[O2[OU[O[O*2[OU[O2[OU2Oo[OVEP
Q5UO[O U2O[O U2O2UO[OU2OU2[OU[O2[OVCP
Q5UO[OU2O[OU2O2[OU[O2[OV%P
Q5UO[OU2O[OU2O2P!�r�r;r<r=��follow_symlinks)r�r(r5r6r=r�rrr�r>r�r�rr�r@r�r;)r�rKrvrwr�r��old_modes&      r"� test_copymode_symlink_to_symlink�)TestCopy.test_copymode_symlink_to_symlinkqs����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���7�7�<�<���0���C����C���
�
�
�3�!�
�
�
�3�!�
����d�l�l�4�<�<�/�0�
����d�l�l�#�
�	�	�(�D�L�L����5�6�
�	�	�(�D�L�L�)��7�7�3�<�'�'������E�B�������(�+�3�3����(�+�3�3�	5���������-�-�x�8�
�	�	�(�D�L�L�)�����u�=���������-�-�r�w�w�s�|�/C�/C�D�
�	�	�(�D�L�L�)�����u�=���������-�-�r�w�w�s�|�/C�/C�Dr$z requires os.lchmod to be missingc���UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[	UQ2[O
V$2[O
V52[OVEP
Q5P!rE)r�r(r5r6r=r�r�r@rAs&     r"�*test_copymode_symlink_to_symlink_wo_lchmod�3TestCopy.test_copymode_symlink_to_symlink_wo_lchmod�s����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���7�7�<�<���0���C����C���
�
�
�3�!�
�
�
�3�!�����E�Br$c	��UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[O
U2o[OV&OUOQ*
12[	UQ2UO[O
U2O[O
U2O2[OV$2[OV52[[Q2%c&[OU[
O2[[Q2%c<[[
Q2%c&[OU[
O2[O U2o[[Q2%cS["O$VEP	Q5UOUO&[O
U2O&2["O$VEP
Q5[O U2o[O[O(7c6QFD.o	UO+[-Vy2[-V�2]*2J0	[[Q2%c'UO/UO&UO&2[[Q2%c9[UQ	2%c'UO/UO0UO02["O$VCP
Q5UO3[5[O
U2O[O
U2O*
2Q
62P!)r�r;r<�quxgE@r�r�r�rFr�g�������?��st_atime�st_mtime)r�r(r5r6r=r�utimerQrRr?r�rnr�r�r�r�r;r��copystatrrH�assertLessEqualrr�r�r��abs)
r�rKrvrwr�r�r��
src_link_stat�
dst_link_stat�attrs
&         r"�test_copystat_symlinks�TestCopy.test_copystat_symlinks�s����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���7�7�<�<���/���C����7�7�3�<��
����(�(��(�(�4�/�1�	2��C������B�G�G�C�L�1�1�2�7�7�3�<�3H�3H�I�
�
�
�3�!�
�
�
�3�!��2�x� � ��I�I�h����-��2�z�"�"�w�t�[�'A�'A��K�K��$�.�.�1�����*�
��2�x� � ��O�O�H��E����
� 5� 5�r�w�w�s�|�7K�7K�L�����E�B�����*�
�
�8�8�r�2�2�2�.���$�$�W�]�%A�%,�]�%A�A�%E�G�/��2�x� � ����]�2�2�M�4I�4I�J��2�z�"�"�w�}�j�'I�'I����]�3�3�]�5K�5K�L�����u�=�����B�G�G�C�L�1�1�B�G�G�C�L�4I�4I�I�J�� �	!r$�chflags�
EOPNOTSUPP�ENOTSUPz)requires os.chflags, EOPNOTSUPP & ENOTSUPc��UO2o[OOUQ2o[OOUQ2o[	UQ2[	UQ2Qo[O
o[O[O1FD*oUU2[m[OV#2J,	U[O[O*2[mUO[[OV#2U[mP!S[mh9h)r��file2�xxxc�6``�[2nQP	-UU1QkkoU!)rGc�:�RRmRgr')r)r5�flagsrG�err�exs&&$��r"�_chflags_raiser�lTestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser.<locals>._chflags_raiser�s�������r$rR)rergrfsf @r"�make_chflags_raiser�STestCopy.test_copystat_handles_harmless_chflags_errors.<locals>.make_chflags_raiser�s#�����B�
��
�
�#�"r$)
r�r(r5r6r=r\rr]r^r�rTr�r)r�r�r�r`ri�old_chflagsres&      r"�-test_copystat_handles_harmless_chflags_errors�6TestCopy.test_copystat_handles_harmless_chflags_errors�s���
����������V�W�-�������V�W�-���E�5�!��E�5�!�	#��j�j��	%��'�'����6��0��5��
�����-�7�-�U�-=�-=��
�
�-M�N�B�J����g�v����E�$�B�J���B�J�s
�>B(D3�3
Ec�```	`
�UO2o[OOUQ2n
[	R
Q2[OOUQ2o[	UQ2[
OR
U2[OR
QQ2[OR
QQ2[
OR
U2UO[[OR
22[[OU222UO[OR
Q2[OUQ22[OU2[	UQ2[[OQ2n	UU	1Qko[OnU[m[
OR
U2UO!Q[OU22R[mQP	-UU
1Q	kko[OnU[m
[
OR
U2R[m
[OOUQ
2n
[OOUQ2o[	R
R
2[	VU2[OR
QQ
2[OUQQ
2[O"UQ2[OOUQ2o[OOUQ2o[	V"2[	Vf2[
O$R
U2[
O$VV2UO[OUQ2Q
2UO[OUQ2Q
2P!R[mh9hR[m
h9h)r�r;�user.foo�42zuser.bar�43�EPERMc�2:�UQ6XcRgRVU1-U@P!)ror@)�fnamerY�valr!�
orig_setxattr�os_errors&&&,��r"�_raise_on_user_foo�3TestCopy.test_copyxattr.<locals>._raise_on_user_foo�s����z�!����e�3�9�&�9r$rGc�Z:�UR6Xc[[OQ2gRVQ5!)zOperation not supportedrF)rrr^)rtrG�orig_listxattrrvs&$��r"�
_raise_on_src�.TestCopy.test_copyxattr.<locals>._raise_on_srcs'�����|��e�m�m�-F�G�G�!�%�I�Ir$�the_original�the_original_rozuser.the_valuesfiddly�$�the_copy�the_copy_ro)r�r(r5r6r=r��
_copyxattr�setxattrr�r_�	listxattr�getxattrrirrrrr rrT)r�rKrwrxr|�srcro�dstror{rvrwrvs&      @@@@r"�test_copyxattr�TestCopy.test_copyxattr�s�����,�,�.���g�g�l�l�7�E�*���C����g�g�l�l�7�E�*���C���	���#�s�#�
���C��U�+�
���C��U�+����#�s�#��������S� 1�2�F�2�<�<��;L�4M�N�������C��,����C��,�	.�	�	�	�#���C����5�;�;��0��	:�
	(��K�K�M�,�B�K����c�3�'��M�M�*�b�l�l�3�&7�8�'�B�K�	J�D�	J�	J�	*��\�\�N�(�B�L����c�3�'�)�B�L��g�g�l�l�7�N�3�������W�&7�8���C����E�!�
���C�)�9�5�
���E�+�Y�7�
�������g�g�l�l�7�J�/�������W�m�4���C���E�!�����S�!�����%�������S�*:�;�Y�G�������U�,<�=�y�I��9(�B�K��*�B�L�s�AN5�2O�5
O�
Oc�`�UO2o[OOUQ2o[OOUQ2o[	UQ2[O
V#2[OUQQ2[OUQQP
Q5[OOUQ2o[OOUQ2o[	UQ2[O
VE2[OV5P
Q5UO[OUQP
Q5Q2UO[[OUQ2[OV4P
Q5UO[OUQ2Q2P!)r�r<ztrusted.foorprqrFr;rO)
r�r(r5r6r=r�r�r�r�r�r�r�r)r�rKrvr�rwr�s&     r"�test_copyxattr_symlinks� TestCopy.test_copyxattr_symlinks(s���,�,�.���g�g�l�l�7�E�*���7�7�<�<���/���C���
�
�
�3�!�
���C���.�
���H�m�U�E�J��g�g�l�l�7�E�*���7�7�<�<���/���C���
�
�
�3�!����(�e�D�������X�}�e�T�V[�\����'�2�;�;��]�C����(��?�������S�-�8�%�@r$c���QoUO2o[V21Q2[OO	V22oUO2oUVE2[OO	VR2oVF1!)r�ra)r�r=r(r5r6)r��methodrtr�r��tmpdir2r`s&&     r"�
_copy_file�TestCopy._copy_fileBs]����������V�O�U�+������V�+���,�,�.���u�������W�,���~�r$c�B�UO[O2vqUO[O
O
U22UO[OU2O[OU2O2P!r')
r�r��copyr�r(r5r�r�rr)r�r�r`s&  r"�	test_copy�TestCopy.test_copyLs[�����v�{�{�3�����������u�-�.���������/�/������1G�1G�Hr$c��UO2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[O
V$2[
[Q2%c;[OU[O[O*2[OVCP	Q5UO[OOU22UO[!U2[!U22[O"U2[OVCP
Q5UO%[OOU22UO[O&U2[O&U22[
[Q2%cQUO[O(U2O*[O(U2O*2P!P!)r�r;r<r�rF)r�r(r5r6r=r�rnr�rr�r�r�r�r�rbr�r\rir�r�r;r)r�rKrvrwr�s&    r"�test_copy_symlinks�TestCopy.test_copy_symlinksRs^���,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���C���
�
�
�3�!��2�x� � ��I�I�h����t�|�|� ;�<����H�4�8����������,�-�����3���3��8�
�	�	�#�����H�5�9���������s�+�,�������S�)�2�;�;�x�+@�A��2�x� � ����R�X�X�h�/�7�7��X�X�c�]�2�2�
4�!r$rSzrequires os.utimec	�X�UO[O2vqUO[O
O
U22[OU2o[OU2oUOUOUO2QFD.oUO[V52[VE2]*2J0	[[Q2%c=[UQ2%c)UO[UQ2[UQ22P!P!P!)rQr\r�rP)
r�r��copy2r�r(r5r�rr�rrUrrn)r�r�r`�
file1_stat�
file2_statrYs&     r"�
test_copy2�TestCopy.test_copy2ks������v�|�|�4�����������u�-�.��W�W�U�^�
��W�W�U�^�
�����+�+�Z�-?�-?�@�*�D�� � ���!:�!(��!:�Q�!>�
@�+��2�y�!�!�g�j�*�&E�&E����W�Z��<�$�Z��<�
>�'F�!r$c	�
�UO2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[O
V$2[
[Q2%c;[OU[O[O*2[
[Q2%c<[
[Q2%c&[OU[O2[OU2o[OU2o[OVCP	Q5UO![OO#U22UO%['U2['U22[O(U2[OVCP
Q5UO+[OO#U22UO%[O,U2[O,U22[OU2o[O.[O07c6QFD.oUO3[5Vh2[5Vx2]*2J0	[
[Q2%cMUO%UO6UO62UO9UO6UO62[
[Q2%c=[
UQ2%c)UO%UO:UO:2P!P!P!)	r�r;r<r�r�r�rFr�rP)r�r(r5r6r=r�rnr�rr�r�r�r�r;r�r�r�rbr�r\rir�r�rSrHrUrrr?r�)	r�rKrvrwr�r�rWr�rYs	&        r"�test_copy2_symlinks�TestCopy.test_copy2_symlinks|s3���,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���/���C���
�
�
�3�!��2�x� � ��I�I�h����t�|�|� ;�<��2�z�"�"�w�t�[�'A�'A��K�K��$�.�.�1��7�7�3�<������*�
����X�D�9����������,�-�����3���3��8�
�	�	�#�����X�E�:���������s�+�,�������S�)�2�;�;�x�+@�A��8�8�C�=��
�8�8�r�2�2�2�.���$�$�W�]�%A�%,�X�%<�q�%@�B�/��2�x� � ����]�2�2�H�4D�4D�E����� 0� 0�(�2B�2B�C��2�z�"�"�w�}�j�'I�'I����]�3�3�X�5F�5F�G�(J�"r$c��UO2o[OOUQ2o[OOUQ2o[	UQ2[O
UQQ2[OV#2UO[OUQ2[OUQ22[OU2P!)r�r;rorp)r�r(r5r6r=r�r�r�r�r�ri)r�rKrvrws&   r"�test_copy2_xattr�TestCopy.test_copy2_xattr�s����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���C���
���C��U�+����S��������C��,����C��,�	.�	�	�	�#�r$c	��[O[O1FD�oUO2oUO2o[O
O
UQ2o[UQ2UVC2oUOU[O
O
UQ22UU[O
O
UQ22oUOU[O
O
UQ22J�	P!)r�r;)	r�r�r�r�r(r5r6r=r�)r�r7r�r�rvr+s&     r"�test_copy_return_value�TestCopy.test_copy_return_value�s����;�;����-�B��l�l�n�G��l�l�n�G��'�'�,�,�w��.�C���U�#��C�!�B����R������g�u�!=�>��C������g�u�5�6�B����R������g�u�!=�>�.r$c�F�UO[O2P!r')�_test_copy_dirr�r�r}s&r"�
test_copy_dir�TestCopy.test_copy_dir�s�����F�K�K�(r$c�F�UO[O2P!r')r�r�r�r}s&r"�test_copy2_dir�TestCopy.test_copy2_dir�s�����F�L�L�)r$c�|�UO2o[OOUQ2oUO2o[OOUQ2o[	UQ2[
OQ6Xc[oL[oUOVaVB2UOVaVE2UV42P!�r��does_not_exist/�win32)
r�r(r5r6r=r~r�r��IsADirectoryErrorr�)r��	copy_funcr��src_filer�rwres&&     r"r��TestCopy._test_copy_dir�s����,�,�.���7�7�<�<���/���|�|�~���g�g�l�l�7�$5�6���H�e�$��<�<�7�"�!�C�#�C����#�$�8�	
���#�$�4��(�!r$c���UO2o[OOUQ2o[OOUQ2o[OOUQ2o[OOUQ2o[	UQ2[O
V%2[OVTP
Q5UO[OOU22UO[OU2[OU22[OVS2UO[OOU22P!)rvrwr�r�r�rF)
r�r(r5r6r=r�r��copyfiler�rbr�r�r�)r�rKrvrwr�r�s&     r"�test_copyfile_symlinks�TestCopy.test_copyfile_symlinks�s����,�,�.���g�g�l�l�7�E�*���g�g�l�l�7�E�*���7�7�<�<���4���w�w�|�|�G�V�,���C���
�
�
�3�������>���������x�0�1�������T�*�B�K�K��,A�B�����"����������,�-r$r�zrequires os.linkc��[O[2[OO	[Q2o[OO	[Q2o[UQ2[OV2UO[O[OV2[UQQQ59^tt^2oUOUO2Q2PPP2[O U2[O"[P	Q5P![c#oSOQS*2Po=K�Po=hh9h)%fhKt9h[O"[P	Q5h9h)rnro�cheddarz
os.link(): %srUrVrWr�)r(r�rr5r6r=r�r�rr�r�rr�r9r�rYrir�)r�rvrwrrPs&    r"�'test_dont_copy_file_onto_link_to_itself�0TestCopy.test_dont_copy_file_onto_link_to_itself�s���	������g�g�l�l�6�8�,���g�g�l�l�6�6�*��	6���Y�'�
3�����!�
���f�2�2�F�O�O�S�N��c�3��1�1�Q�� � �����9�5�2��I�I�c�N��M�M�&��5��#�
3��
�
�o��1�2�2��
3��2�1��
�M�M�&��5�s[�%E-�2D*�AE-�
!E�.E-�*	E�4E�5E�
E-�E�E-�E*	�#E*	�%E-�-Fc��[O[2[OO	[Q2o[OO	[Q2o[UQ2[OQU2UO[O[OV2[UQQQ59^tt^2oUOUO2Q2PPP2[OU2[O[P	Q5P!)%fhKD9h[O[P	Q5h9h)rnror�rUrVrWr�)r(r�rr5r6r=r�r�r�rr�r9r�rYrir�)r�rvrwrPs&   r"�*test_dont_copy_file_onto_symlink_to_itself�3TestCopy.test_dont_copy_file_onto_symlink_to_itself�s���	������g�g�l�l�6�8�,���g�g�l�l�6�6�*��	6���Y�'�
�J�J�x��%����f�2�2�F�O�O�S�N��c�3��1�1�Q�� � �����9�5�2��I�I�c�N��M�M�&��5�	2�1��
�M�M�&��5�s+�%A(D=�
!D*�.D=�*D:	�3D:	�5D=�=Erwrxryrzc���[O[2UO[O[O[[2UO[O[O[[2[O[2P![c#oSO	QS*2Po=K�Po=hh9h[O[2h9h)r)r(rwrr�rr�r��SpecialFileErrorr�r�__file__ri)r�rs& r"�test_copyfile_named_pipe�!TestCopy.test_copyfile_named_pipes���	1��I�I�f��	����f�5�5� &�����
B����f�5�5� &����6�
C�
�I�I�f����	1��M�M�+�a�/�0�0��	1��
�I�I�f��s)�B*�A0C�*	C�4C�5C�C�C6c��UO2oUO2o[OOUQ2o[OOUQ2o[	UQ2[
OVC2oUO[OOU22UO[U2[U22P!)r;r�)r�r(r5r6r=r�r�r�r�r�r\)r�r�r��dst_filer�r+s&     r"�test_copyfile_return_value�#TestCopy.test_copyfile_return_values����,�,�.���,�,�.���7�7�<�<���/���7�7�<�<���/���H�e�$�
�_�_�X�
0����������r�*�+�����8�,�i��.A�Br$c�J�UO2o[OOUQ2o[	UQ2UO[[OV"2UO[[OV"2UO[U2Q2P!)r�)r�r(r5r6r=r�rr�r�rr�r\)r�r�r�s&  r"�test_copyfile_same_file� TestCopy.test_copyfile_same_file#sn���,�,�.���7�7�<�<���/���H�e�$����-����(�M����%����(�E�����8�,�e�4r$zMOn MACOS, Solaris and Windows the errors are not confusing (though different)zNot valid on AIX, see gh-92670c�
�UO2o[OOUQ2o[OOUQ2o[	UQ2UO[[OV#2P!)r�r�)	r�r(r5r6r=r�r�r�r�)r�r�r�rws&   r"�test_copyfile_nonexistent_dir�&TestCopy.test_copyfile_nonexistent_dir/sY���,�,�.���7�7�<�<���/���g�g�l�l�7�$5�6���H�e�$����+�V�_�_�h�Lr$c���UO2o[OOUQ2oUO2o[OOUQ2o[	UQ2[
OQ6Xc[oL[oUOU[OV2UOU[OV!2UOU[OV12P!r�)r�r(r5r6r=r~r�r�r�r�r�r�)r�r�r�r�rwres&     r"�test_copyfile_copy_dir�TestCopy.test_copyfile_copy_dir<s����,�,�.���7�7�<�<���/���|�|�~���g�g�l�l�7�$5�6���H�e�$��<�<�7�"�!�C�#�C����#�v����=����#�v����B����#�v����>r$r@)/r�r�r�r�rr�rBr�r�rnr(rIr�rLrZrrl�skip_unless_xattrr��skip_unless_dac_overrider�r�r�r�r�r�r�r�r�r�r�r�r�r�r~r�r�r�r��MACOS�SOLARISr�r}r�r�r�r�r�s@r"r9r9Ns������"�"�E�#�E�<�����X�.�0D�E��"�"�E�#�F�E�:�_�_�W�R��*�,N�O��"�"�
C�#�P�
C��"�"�&!�#�&!�P�����Y�/�3�3� ���5�3�3� ��	�2�D�F�%�	F�%�6� � �=J�!�=J�~�"�"�� � ��'�'�A�(�!�#�A�.�I��"�"�4�#�4�0�����W�-�/B�C�>�D�>� �"�"� H�#� H�D� � �
�!�
�
?�)�*�"�$�"�"�.�#�.� �����V�,�.@�A�6�B�6�$�"�"�6�#�6�&�����X�.�0F�G�
�_�_�S�\�\�Y�.�;�=��=�H��	C�
5��_�_�U�0�0�g�0�0��3B�C��_�_�S�:�;�M�<�	C�
M�?�?r$r9c�`�\sQsQsnQsQ.Qks\O2Q2s\O2Q2s	Qs
\O2\O\
OQ2Q2Q	22s\O2Q
2s\O2Q2s\O2Q2s\O2\O\
OQ
2Q2Q22s\O2\O\
OQ2Q2Q22sQs\O2Q2s\O2\O\Q2Q22sQsQsQsQs\O2Q2sQsQsQs Qs!\O2Q 2s"Q!s#Q"s$Q#s%Q$s&\O2Q%2s'\OP2Q&2s)\OT2Q'2s+\OX2\OZ\.9%c
\/2%(Q(2Q)22s0\O2Q*2s1Q+s2Q,s3Q-s4Us5P!)/�TestArchivesiOc���[OU29^tt^2oUO2oUO2[	U2ttPPP2!)%fhP!9hr')�tarfiler9�getnames�sortr4)r�r5�tarr�s&&  r"�_tarinfo�TestArchives._tarinfoSs=��
�\�\�$�
�
�3��L�L�N�E��J�J�L���<� �
�
�
�s�+A�A'	�A'	c���UO2o[OOV!2o[OUP	Q5[UQ1Q2[UQ1Q2[O[OOUQ22[UQQ1Q2[O[OOUQ22U%c[UQ1Q2V!1!)	T)�exist_okr�rar`r��file3�sub2�outer)r�r(r5r6r�r=r�)r�r3�root_dir�dists&&  r"�
_create_files�TestArchives._create_filesYs����<�<�>���w�w�|�|�H�/��
���D�4�(��T�7�O�U�+��T�7�O�U�+�
��������d�E�*�+��T�5�'�*�E�2�
��������d�F�+�,����7�+�U�3��!�!r$c
�<	�UO2vq[O29^tt^2[9^tt^2[O
O
QQ2o[UQU2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OUQ29^tt^2oUOUO!2,Q
N2PPP2PPP2PPP2[O29^tt^2[9^tt^2[O
O
QQ2o[UQV2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OUQ29^tt^2oUOUO!2,QN2PPP2PPP2PPP2[O29^tt^2[9^tt^2[O
O
QQ2o[UQU[O
O
UQ	22oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OUQ29^tt^2oUOUO!2QQ,2PPP2PPP2PPP2P!)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhK�9h)%fhK�9h)%fhP!9h)rw�archiver��.tarrU�dst2�dist/sub�dist/sub/file3�dst3r���.z./distz
./dist/subz./dist/sub2z./dist/file1z./dist/file2z./dist/sub/file3z./outer�r�r�z	dist/sub2�
dist/file1�
dist/file2r�)r�r�temp_cwd�no_chdirr(r5r6rr��abspathr�r�r��
is_tarfiler9�assertCountEqualr��r�r�r3�	base_namer��tfs&     r"�test_make_tarfile�TestArchives.test_make_tarfilegs���!�/�/�1���
�
�
�
!�
!�8�8������U�I�6�I�"�9�e�X�>�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�s�+�+�r��%�%�b�k�k�m�$�%�,�$,�
!��
�
�
!�
!�8�8������V�Y�7�I�"�9�e�X�H�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�s�+�+�r��%�%�b�k�k�m�G�H�,�$,�
!��
�
�
!�
!�8�8������V�Y�7�I�"�9�e�X�#%�7�7�<�<��%�#@�B�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�s�+�+�r��%�%�b�k�k�m�#�%5�6�8�,�$,�
!�
!�),�+�+��$,�8�8��
!�
!�
!��*,�+�+��$,�8�8��
!�
!�
!��(,�+��$,�8��
!�
!�
!�s��P�CP	�#O,
�9P	�P�.Q�=CP<	�#P(
�6P<	�>Q�+R
�:C5Q7	�/#Q$
�Q7	�R
�,O=�5O=�7	P	�P
�	P
�	P�P%	�P%	�(P9�1P9�3	P<	�<Q

�Q

�	Q�Q!	�Q!	�$Q4�-Q4�/Q7	�7R
�R
�R
�
R	�R	c���UO2vq[OOUO	2QQ2o[OOV12o[OU29^tt^2[9^tt^2[UQ2oUOVCQ*2UO[OOU22UO[OU22[OUQ29^tt^2oUO!UO#2,Q	N2PPP2PPP2PPP2[OU29^tt^2[9^tt^2[OOQQ2o[UQUQ5oUOVCQ*2UO[OOU22UO[OU22[OUQ29^tt^2oUO!UO#2,Q
N2PPP2PPP2PPP2P!)%fhCKD9h)%fhCKP9h)%fhCK\9h)%fhK^9h)%fhKi9h)%fhP!9h)rwr��gztar�.tar.gzzr:gzr��r3r�rUr�r�)r�r(r5r6r��relpathr�
change_cwdr�rr�r�r�r�r�r9r�r�r�s&     r"�!test_make_tarfile_without_rootdir�.TestArchives.test_make_tarfile_without_rootdir�s���!�/�/�1����G�G�L�L������	�B�	��G�G�O�O�I�8�	�
�
!�
!�(�
+�
+�X�X�"�9�g�6�G����W�)�&;�<��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�v�.�.�"��%�%�b�k�k�m�$�%�/�.6�
+��
!�
!�(�
+�
+�X�X������U�I�6�I�"�9�e�h�G�G����W�&�&8�9��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�s�+�+�r��%�%�b�k�k�m�G�H�,�
.6�
+�
+�/�.�.��.6�X�X��
+�
+�
+��$,�+��
.6�X��
+�
+�
+�s��J,�BJ	�&#J
�	J	�J,�?K&�B9K	�#K
�*K	�2K&�J�
J�	J	�J)
�!J)
�#	J,�,J=	�5J=	�K�	K�K	�K#
�K#
�K&�&K7	�/K7	c�8�UO2vq[O29^tt^2[9^tt^2[O
O
QQ2o[UQU[O2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OUQ29^tt^2oUO!UO#2,QN2PPP2PPP2PPP2P!)%fhK"9h)%fhK-9h)%fhP!9h)rwr�r�r�rUr�)r�rr�r�r(r5r6r�curdirr�r�r�r�r�r�r9r�r�r�s&     r"�&test_make_tarfile_with_explicit_curdir�3TestArchives.test_make_tarfile_with_explicit_curdir�s���!�/�/�1���
�
�
�
!�
!�8�8������U�I�6�I�"�9�e�X�r�y�y�I�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8����g�s�+�+�r��%�%�b�k�k�m�$�%�,�
$,�
!�
!�,�+��
$,�8��
!�
!�
!�sN�F�C%E5	�%#E"
�E5	�F�"E2�+E2�-E5	�5F
�>F
�F�F	�F	r�zNeed the tar command to runc
��UO2vq[OOUO	2Q2o[
9^tt^2[
UQV2oPPP2UOWUQ*2UO[OOU22[OOUQ2oQQQU,o[OQ6XcR]PH.o[UO2]*OQ2]*2]6�cUO]Q2[ O"Va[ O$Q	5UO[OOU22UOUO'U2UO'U22[
9^tt^2[
UQV2oPPP2UOVCQ
*2UO[OOU22[
9^tt^2[
UQVP	Q5oPPP2UOVCQ
*2UO[OOU22P!)%fhCK@9h)%fhK�9h)%fhK9h)r�rrzarchive2.tarr�z-cfrr�z--no-mac-metadata��cwd�stdoutr���dry_run)r�r(r5r6r�r�rr�r�r�r~r�r��mac_verr��insertr��
check_call�DEVNULLr�)r�r�r3r��tarball�tarball2�tar_cmdr�s&       r"�test_tarfile_vs_tar� TestArchives.test_tarfile_vs_tar�s���"�/�/�1����G�G�L�L������;�	�
�X�"�9�g�x�J�G��	
����)�i�"7�8���������w�/�0��7�7�<�<��.�9���%���:���<�<�8�#�
��8�#�#�%�a�(�.�.�s�3�A�6�7�2�=����q�"5�6����g�%/�%7�%7�	9�	
��������x�0�1�������w�/����x�1H�I��X�"�9�e�X�H�G������f�"4�5���������w�/�0��X�"�9�e�X�+/�1�G��	
����f�"4�5���������w�/�0�O�X�X��:�X���X�s6�J�J)�5J<�J&	�J&	�)J9	�2J9	�<K	�K	c
�6	�UO2vq[O29^tt^2[9^tt^2[O
O
QQ2o[UQU2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OU29^tt^2oUOUO!2,Q	N2PPP2PPP2PPP2[O29^tt^2[9^tt^2[O
O
QQ2o[UQV2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OU29^tt^2oUOUO!2,Q
N2PPP2PPP2PPP2[O29^tt^2[9^tt^2[O
O
QQ2o[UQU[O
O
UQ22oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OU29^tt^2oUOUO!2QQ,2PPP2PPP2PPP2P!)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhK�9h)%fhK�9h)%fhP!9h)rwr�r��.zip�	dist/sub/r�r�r�r���dist/r�
dist/sub2/r�r�r�r��r rr!r�r�r�)r�rr�r�r(r5r6rr�r�r�r��zipfile�
is_zipfile�ZipFiler��namelist�r�r�r3r�r��zfs&     r"�test_make_zipfile�TestArchives.test_make_zipfile�s���!�/�/�1���
�
�
�
!�
!�8�8������U�I�6�I�"�9�e�X�>�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�"�#�*�
$,�
!��
�
�
!�
!�8�8������V�Y�7�I�"�9�e�X�H�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�G�H�*�
$,�
!��
�
�
!�
!�8�8������V�Y�7�I�"�9�e�X�#%�7�7�<�<��%�#@�B�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�$�&6�7�9�*�$,�
!�
!�'*�)�)��
$,�8�8��
!�
!�
!��&*�)�)��
$,�8�8��
!�
!�
!��&*�)��$,�8��
!�
!�
!�s��P�CO=	�#O)
�8O=	�P�-Q
�<CP9	�#P%
�4P9	�<Q
�)R�8C4Q4	�,#Q!
�Q4	�R�)O:�2O:�4	O=	�=P
�P
�	P�P"	�P"	�%P6�.P6�0	P9	�9Q

�Q

�	Q
�
Q	�Q	�!Q1�*Q1�,Q4	�4R
�=R
�?R�R	�R	c��UO2vq[OOUO	2QQ2o[OOV12o[OU29^tt^2[9^tt^2[UQ2oUOVCQ*2UO[OOU22UO[OU22[OU29^tt^2oUO!UO#2,QN2PPP2PPP2PPP2UO2vq[OU29^tt^2[9^tt^2[OOQQ2o[UQUQ5oUOVCQ*2UO[OOU22UO[OU22[OU29^tt^2oUO!UO#2,QN2PPP2PPP2PPP2P!)%fhCKU9h)%fhCKa9h)%fhCKm9h)%fhK^9h)%fhKi9h)%fhP!9h)rwr�r�rrrr")r�r(r5r6r�rrrr�rr�r�r�r#r$r%r�r&r's&     r"�!test_make_zipfile_without_rootdir�.TestArchives.test_make_zipfile_without_rootdirs���!�/�/�1����G�G�L�L������	�B�	��G�G�O�O�I�8�	�
�
!�
!�(�
+�
+�X�X�"�9�e�4�G����W�&�&8�9��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�"�#�*�.6�
+�"�/�/�1���
�
!�
!�(�
+�
+�X�X������U�I�6�I�"�9�e�h�G�G����W�&�&8�9��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�G�H�*�
.6�
+�
+�*�)�)��.6�X�X��
+�
+�
+��&*�)��
.6�X��
+�
+�
+�s��J<�BJ(	�%#J
�J(	�J<�K6�B8K#	�#K
�:K#	�K6�J%�J%�	J(	�(J9
�1J9
�3	J<�<K
	�K
	�K �K �K#	�#K3
�,K3
�.K6�6L	�?L	c�6�UO2vq[O29^tt^2[9^tt^2[O
O
QQ2o[UQU[O2oUOU[O
OU2Q*2UO[O
OU22UO[OU22[OU29^tt^2oUO!UO#2,QN2PPP2PPP2PPP2P!)%fhK"9h)%fhK-9h)%fhP!9h)rwr�r�rr)r�rr�r�r(r5r6rr
r�r�r�r�r#r$r%r�r&r's&     r"�&test_make_zipfile_with_explicit_curdir�3TestArchives.test_make_zipfile_with_explicit_curdir2s���"�/�/�1���
�
�
�
!�
!�8�8������U�I�6�I�"�9�e�X�r�y�y�I�G����W�b�g�g�o�o�i�&@�6�&I�J��O�O�B�G�G�N�N�7�3�4��O�O�G�.�.�w�7�8�����)�)�R��%�%�b�k�k�m�"�#�*�
$,�
!�
!�*�)��
$,�8��
!�
!�
!�sN�F�C$E4	�$#E!
�E4	�F�!E1�*E1�,E4	�4F
�=F
�?F�F	�F	r�zNeed the zip command to runc���UO2vq[OOUO	2Q2o[
9^tt^2[
UQV2oPPP2UOWUQ*2UO[OOU22[OOUQ2oQQQQU,o[OVa[OQ5UO[OOU22[OU29^tt^2oUO2oPPP2[OU29^tt^2oUO2o	PPP2UO[!W2[!W	22P!)%fhCKg9h)%fhK�9h)%fhK]9h)r�r�rzarchive2.zipz-qz-rr)r�r(r5r6r�r�rr�r�r�r�rrr#r%r&r_)
r�r�r3r�r��archive2�zip_cmdr(r��names2s
&         r"�test_zipfile_vs_zip� TestArchives.test_zipfile_vs_zipBsE��"�/�/�1����G�G�L�L������;�	�
�X�"�9�e�X�H�G��	
����)�f�"4�5���������w�/�0��7�7�<�<��.�9���$��n�h�?�����g�%/�%7�%7�	9�	
��������x�0�1�
�_�_�W�
%�
%���K�K�M�E�&�
�_�_�X�
&�
&�"��[�[�]�F�'��������v��7�'�X�X��&�
%��
&�
&�s6�F<�G�=G#�<G
	�G
	�G 	�G 	�#G3	�,G3	�unzipzNeed the unzip command to runc	�`�UO2vq[OOUO	2Q2o[
9^tt^2[
UQV2oPPP2UOWUQ*2UO[OOU22QQU,o[OU29^tt^2[OU[OQ5PPP2P!)%fhK�9h[Oc�oSO O#QQ5n[$9PIc!S1QkQ	Q
,2D%fJP	L	P
LS1QkQ	Q
,22%cSO'Q2QoSO)SO+SR22Po=K�Po=hh9h)%fhP!9h)
r�r�rr7z-t)�stderr�replace)r�c3�8:�SF �D
pR7w�	J	P!3hr'r@)r��message�detailss& �r"r��2TestArchives.test_unzip_zipfile.<locals>.<genexpr>qs��:���:�g�'�)�:�s�zunrecognized option: tzinvalid option -- tzunzip doesn't support -tz{}

**Unzip Output**
{})r�r(r5r6r�r�rr�r�r�rrr��check_output�STDOUT�CalledProcessError�output�decode�anyrr�format)	r�r�r3r�r�r3r��msgr=s	&       @r"�test_unzip_zipfile�TestArchives.test_unzip_zipfile]si���"�/�/�1����G�G�L�L������;�	�
�X�"�9�e�X�H�G��	
����)�f�"4�5���������w�/�0��D�'�*��
�
!�
!�(�
+�
+�

4��'�'��
�8I�8I�J�,�
+��X���0�0�
4��*�*�+�+�9�+�=���3��,�)�:��3�3�3��,�)�:�����M�M�"<�=�2���	�	�#�*�*�S�'�2�3�3��
4��,�
+�
+�s`�D�G�&D�D	�D	�G�*G�+&G�G�+G�
4G�>G�G�G�G	�G	c��UO2o[OOUQ2oUO	[
[UQ2P!)r�ra)r�r(r5r6r��
ValueErrorr)r�r�r�s&  r"�test_make_archive�TestArchives.test_make_archiveys5��������G�G�L�L���3�	����*�l�I�u�Er$c	��[%c<[O]2]*o[O]2]*oLQ9qUO2vq4[OOUO2Q2o[UQV4UUQ5oUO[OOU22[UQV42oUO[OOU22[UQV4V!Q5oUO[OOU22[UQV4QQQ5oUO[OOU22P!)rrr�r���owner�groupr��	kjhkjhkjg�oihohoh)
�UID_GID_SUPPORT�grp�getgrgid�pwd�getpwuidr�r(r5r6r�rr�r�)r�rPrOr�r3r�res&      r"�test_make_archive_owner_group�*TestArchives.test_make_archive_owner_group~s���?��L�L��O�A�&�E��L�L��O�A�&�E�"�"�E�!�/�/�1����G�G�L�L������;�	��9�e�X�u�!&�(����������s�+�,��9�e�X�@����������s�+�,��9�e�X�!&�5����������s�+�,��9�e�X�!,�I�?����������s�+�,r$�Requires grp and pwd supportc
�X�UO2vq[OOUO	2Q2o[
O]2]*o[O]2]*o[OU29^tt^2[9^tt^2[UQUQVTQ5oPPP2PPP2UO[OOW22[O U2oUO#2FD;oUO%UO&]2UO%UO(]2J=	UO+2P!)%fhK�9h)%fhK�9hSO+2h9h)r�rr�rN)r�r(r5r6r�rTrUrVrWrrr�rr�r�r�r9�
getmembersr��uid�gidrV)	r�r�r3r�rPrO�archive_namer��members	&        r"�test_tarfile_root_owner�$TestArchives.test_tarfile_root_owner�s��"�/�/�1����G�G�L�L������;�	����Q���"�����Q���"��
�
!�
!�(�
+�
+�X�X�'�	�7�H�f�.3�B�L�.6�
+�
	
��������|�4�5��,�,�|�,��	�!�,�,�.��� � ����Q�/�� � ����Q�/�/�
�M�M�O�.6�X��
+�
+��
�M�M�O�s=�F�)E1	�:F�AF�1F
�:F
�<F�F	�
F	�F)c	�``�[O2nUU1Qko[QU,Q2[9^tt^2RO	[
29^tt^2[
QQ2PPP2PPP2RO[O2R2[Q2P!)%fhKJ9h)%fhKU9h[Q2h9h)c�:�ROQU2ROUQ2RO[O2R2[	2g�r��basename)rr�r(rq�RuntimeError)r�r3�kw�current_dirr�s&&,��r"�archiver�<TestArchives.test_make_archive_cwd_default.<locals>.archiver�sA������Z��,����Y�
�3����R�Y�Y�[�+�6��.� r$ra�xxx filerf)	r(rqrr�r�rgrr�r)r�rjrisf @r"�test_make_archive_cwd_default�*TestArchives.test_make_archive_cwd_default�s�����i�i�k��	!�	 ��x��Z�@�	-����&�&�|�4�4� ��U�3�5��
���R�Y�Y�[�+�6�%�e�,�	5�4�����

&�e�,�sF�C�B=�
B*	�(B=�0-C�*B:
�3B:
�5B=�=C
	�C
	�C�
Cc
�R`````�[O2nRO2nUUU1Qko,nUU1Qko[QU,Q2[O
[QU29^tt^2nRO
[29^tt^2[QQRQ5PPP2PPP2RO[O2R2RORRR,2[Q2P!)%fhK^9h)%fhKi9h[Q2h9h)c��:�ROQU2ROU[OO	RQ22RO[O
2R2[
2gre)rr�r(r5r6rqrg�r�r3rhrir�r�s&&,���r"rj�4TestArchives.test_make_archive_cwd.<locals>.archiver�sP������Z��,����Y������[�*�(M�N����R�Y�Y�[�(�3��.� r$c�<:�ROU2RU2P!r'r�)r5r��
orig_chdirs&��r"�_chdir�2TestArchives.test_make_archive_cwd.<locals>._chdir�s����K�K����t�r$rarl�chdirrf�r�)r(rqr�rrrZr�rgrr�r)r�rjrurir�rtr�sf  @@@@r"�test_make_archive_cwd�"TestArchives.test_make_archive_cwd�s�����i�i�k���<�<�>��	!�
��	�	 ��x��Z�@�	-��"�"�2�w��7�7�:��&�&�|�4�4� ��U�X�F�5�8�
���R�Y�Y�[�+�6����T�H�k�#:�;�%�e�,�5�4��8�7��
&�e�,�sI�$D�0D�C3	�D�%AD�3D
�<D
�>D�D	�D	�D�
D&c
�```�[O2nRO2nUUU1QkoP	Um[	QU,Q2[
9^tt^2RO
[29^tt^2[QQRQ5PPP2PPP2RO[O2R2[Q2P!)%fhKJ9h)%fhKU9h[Q2h9h)c�:�ROUQ2ROUQ*R2RO[O2R2[2g)rfr�)r�r(rqrgrqs&&,���r"rj�FTestArchives.test_make_archive_cwd_supports_root_dir.<locals>.archiver�sE������Y�
�3����R�
�^�X�6����R�Y�Y�[�+�6��.� r$rarlrfrx)r(rqr��supports_root_dirrr�r�rgrr�r)r�rjrir�sf @@r"�'test_make_archive_cwd_supports_root_dir�4TestArchives.test_make_archive_cwd_supports_root_dir�s�����i�i�k���<�<�>��	!�
&*��"���x��Z�@�	-����&�&�|�4�4� ��U�X�F�5��
���R�Y�Y�[�+�6�%�e�,�	5�4�����

&�e�,�sH�C+�C�4C	�C�-C+�C
�C
�C�C(	�!C(	�#C+�+
C8c
��UO2o[OU29^tt^2[9^tt^2UO	[QQ2Q2UO
[OOQ22PPP2PPP2P!)%fhK9h)%fhP!9h)�testr�ztest.tar�
r�rrr�r�rr�r(r5r��r�r�s& r"�test_make_tarfile_in_curdir�(TestArchives.test_make_tarfile_in_curdir�sl���<�<�>��
�
!�
!�(�
+�
+�X�X����\�&�%�8�*�E��O�O�B�G�G�N�N�:�6�7�.6�
+�
+�X�X��
+�
+�
+��/�B/�AB	�
B/�B,
�%B,
�'B/�/C	�8C	c
��UO2o[OU29^tt^2[9^tt^2UO	[QQ2Q2UO
[OOQ22PPP2PPP2P!)%fhK9h)%fhP!9h)r�r��test.zipr�r�s& r"�test_make_zipfile_in_curdir�(TestArchives.test_make_zipfile_in_curdir�sn���<�<�>��
�
!�
!�(�
+�
+�X�X����\�&�%�8�*�E��O�O�B�G�G�N�N�:�6�7�.6�
+�
+�X�X��
+�
+�
+�r�c�`�,nU1Qko[QU,Q2UO[Q2[9^tt^2[	[Q2Q2PPP2UO
RQ,2P!)%fhK%9h)c�L:�ROVOQ212P!rx�rc�get�r�r3rh�called_argss&&,�r"rj�ETestArchives.test_make_archive_pathlike_cwd_default.<locals>.archiver�s������	�6�6�*�+=�>�?r$rarlrf)rfN)rr�rr�rrr�)r�rjr�s& @r"�&test_make_archive_pathlike_cwd_default�3TestArchives.test_make_archive_pathlike_cwd_default�sb�����	@�	 ��x��Z�@����1�5�9�
�X���*�-�u�5������'9�&:�;��X�s�A0�0B	�9B	c
�d`�UO2o,nU1QkoP	Um[QU,Q2UO[Q2[
9^tt^2[
[Q2Q[U2[Q2Q5PPP2UORQQU1,2P!)%fhK(9h)c�N:�ROVUOQ212P!rxr�r�s&&,�r"rj�OTestArchives.test_make_archive_pathlike_cwd_supports_root_dir.<locals>.archivers������	�R�V�V�J�5G�H�Ir$rarlrf�basedir)r�r3)	r�r~rr�rr�rrr�)r�r�rjr�s&  @r"�0test_make_archive_pathlike_cwd_supports_root_dir�=TestArchives.test_make_archive_pathlike_cwd_supports_root_dirs�����<�<�>����	J�%)��"���x��Z�@����1�5�9�
�X���*�-�u�"*�8�"4�"*�9�"5�
7��	
����
�I�x�'H�&I�J�	�X�s�+B�B/	�(B/	c���UO[[Q]2UO[[QQ]2UO[[QQQQ,2[QQQ,Q2[2TTt,tFDvqUMJ		oooUO	QU2[Q2[2TTt,tFDvqUMJ		oooUO
QU2P!ttoohttooh)rac��[!r'��xr@r$r"�<lambda>�;TestArchives.test_register_archive_format.<locals>.<lambda>���Qr$c��[!r'r�r@r$r"r�r�r�r$c��[!r'r�r@r$r"r�r�s��qr$rl)rQr)rQrr)r�r�rrr rr)r�rf�params�formatss&   r"�test_register_archive_format�)TestArchives.test_register_archive_formats������)�%<�e�Q�G����)�%<�e�Y��	����)�%<�e�Y�!�9�-�	/�	 ��y�6�(�J�G�,?�,A�B�,A�L�D�4�,A��B��
�
�e�W�%�!�%�(�,?�,A�B�,A�L�D�4�,A��B������(��C��Cs�8C�3Cc
��UO[O[Q02QFCDoUO	UQ59^tt^2UO2o[OOUQ2oUO[29^tt^2o[[QV1Q5PPP2UOWOO[O2UOUOO U2UO#[OO%[Q022[&O(UQ5vqV[O*U2UO[,29^tt^2o[[QVaQ5PPP2UOUOO[O.2UOUOO U2UO#[OO%[Q022PPP2CJ	P!)%fhCK�9h)%fhK�9h)%fhCJT9h)r�r�nonexistingr�r��FT�r�rrsr�subTestr�r(r5r6r�r�rr�r�r�ENOENTr�r�r�rorhrVr��ENOTDIR�r�rrK�nonexisting_filer��tmp_fd�tmp_files&      r"�test_make_tarfile_rootdir_nodir�,TestArchives.test_make_tarfile_rootdir_nodir's������	�(�(�V�H�D�/�:�$�G����g��.�.��,�,�.��#%�7�7�<�<���#G� ��&�&�'8�9�9�R� ���0@�R�:�� � ����!3�!3�U�\�\�B�� � ����!6�!6�8H�I�� � ������6�(�$��!@�A�$,�#3�#3��#@� ������ ��&�&�'9�:�:�b� ����J�;�� � ����!3�!3�U�]�]�C�� � ����!6�!6��A�� � ������6�(�$��!@�A�#/�.�%�
:�9�9��;�:��/�.�.��Q�
AI.	�I
�+C#I.	�I
�!BI.	�I�I�	I.	�I+�$I+�&I.	�.J
�7J
c
��UO[O[Q02QFCDoUO	UQ59^tt^2UO2o[OOUQ2oUO[29^tt^2o[[QV1Q5PPP2UOWOO[O2UOUOO U2UO#[OO%[Q022[&O(UQ5vqV[O*U2UO[,29^tt^2o[[QVaQ5PPP2UOUOO[O.2UOUOO U2UO#[OO%[Q022PPP2CJ	P!)%fhCK�9h)%fhK�9h)%fhCJT9h)rrr�r�r�r�r�r�s&      r"�test_make_zipfile_rootdir_nodir�,TestArchives.test_make_zipfile_rootdir_nodir>s���	
���	�(�(�V�H�D�/�:�$�G����g��.�.��,�,�.��#%�7�7�<�<���#G� ��&�&�'8�9�9�R� ���0@�R�:�� � ����!3�!3�U�\�\�B�� � ����!6�!6�8H�I�� � ������6�(�$��!@�A�$,�#3�#3��#@� ������ ��&�&�'9�:�:�b� ����J�;�� � ����!3�!3�U�]�]�C�� � ����!6�!6��A�� � ������6�(�$��!@�A�#/�.�%�
:�9�9��;�:��/�.�.�r�c�f�UOUQ1-U@UOU[1-U@P!)c��U!r'r@�r5s&r"r��3TestArchives.check_unpack_archive.<locals>.<lambda>Zs��r$)�#check_unpack_archive_with_converterr)r�rEr!s&&,r"�check_unpack_archive�!TestArchives.check_unpack_archiveXs3���0�0��%�	1�)/�	1��0�0���L�V�Lr$c�J�UO2vqE[U2oUOQ2[OOUO
2Q2o[VqVE2oUO
2o	[UU2UU	21-U@UO[U	2U2UO
2o
[UU2UU
21QU-U@UO[U
2U2UO[O29^tt^2[U[21-U@PPP2UO[29^tt^2[U[21QQ-U@PPP2P!)%fhKQ9h)%fhP!9h)r�r�rEra)r�rdrir(r5r6r�rrr�r�r��	ReadErrorrrJ)r�rE�	converterr!r�r3�expectedr�r�r��tmpdir3s&&&,       r"r��0TestArchives.check_unpack_archive_with_converter]sB��!�/�/�1����H�%������ ��G�G�L�L������;�	��	�8�F���,�,�.���y��*�I�g�,>�I�&�I�����'�*�H�5��,�,�.���y��*�I�g�,>�	!�v�	!��	!�����'�*�H�5�
�
�
�v�/�/�
0�
0��9�V�,�7��7�1�
�
�
�z�
*�
*��9�V�,�E�U�E�f�E�+�
*�1�
0��
*�
*�
*�s$�E>�F�>F	�F	�F"	�F"	c�T�UOUQQ5UOUQQ5P!)�
fully_trusted��filter�data)r�)r�rEs&&r"�check_unpack_tarball�!TestArchives.check_unpack_tarballus(���!�!�&��!�A��!�!�&��!�8r$c�*�UOQ2P!)r��r�r}s&r"�test_unpack_archive_tar�$TestArchives.test_unpack_archive_tarys���!�!�%�(r$c�*�UOQ2P!)rr�r}s&r"�test_unpack_archive_gztar�&TestArchives.test_unpack_archive_gztar|����!�!�'�*r$c�*�UOQ2P!)�bztarr�r}s&r"�test_unpack_archive_bztar�&TestArchives.test_unpack_archive_bztar�r�r$c�*�UOQ2P!)�zstdtarr�r}s&r"�test_unpack_archive_zstdtar�(TestArchives.test_unpack_archive_zstdtar�s���!�!�)�,r$z(AIX MAXDATA must be 0x20000000 or largerc�*�UOQ2P!)�xztarr�r}s&r"�test_unpack_archive_xztar�&TestArchives.test_unpack_archive_xztar�s��	
�!�!�'�*r$c���UOQ2UO[29^tt^2UOQQQ5PPP2P!)%fhP!9h)r�r�r�)r�r�r�r}s&r"�test_unpack_archive_zip�$TestArchives.test_unpack_archive_zip�sC���!�!�%�(�
�
�
�y�
)�
)��%�%�e�F�%�;�*�
)�
)�
)�s�A�A	�A	c�^�UO2o[OOUQ2o[OOUQ2o[O
UQ29^tt^2oUO
UQ2UO
[OU*Q2UO
QQ2UO
QQ2UO
QQ2UO
QQ2UO
QQ2UO
Q	Q2UO
Q
Q2UO
QQ2UO
[O[O*Q*Q2UO
Q
Q2UO
QQ2PPP2[OOUO2Q2o[V%2UO[OO[OOUQQ222UO[OO[OOUQ222UO[OOU22UO[OO[OOUQ222UO[OO[OOUQ222UO[OO[OOUQ222[OQ6wCc�UO[OO[OOUQQ222UO[OO[OOUQ222UO[OO[OOUQ222UO[OO[OOUQQQ222UO[OO[OOUQ
222[OQ6Xc�UO[OO[OOUQQ222UO[OO[OOUQ222LMUO[OO[OOUQQ222UO[OO[OOU[OQ222UO[OO[OOUQ222[OOUO2Q2o[OU2[ O"U29^tt^2[UP2UO[OO[OOQQ222UO[OOQ22UO[OOU22UO[OOQ22UO[OOQ22UO[OOQ22[OQ6wCc$UO[OO[OOQQ222UO[OOQ22UO[OOQ22UO[OO[OOQQQ222UO[OOQ
22[OQ6Xc|UO[OO[OOQQ222UO[OOQ22LLUO[OO[OOQQ222UO[OO[OO[OQ222UO[OOQ22PPP2P!)%fhC	Ku9h)%fhP!9h)r�r��w�badfilez/abspathz
C:/abspathz
D:\abspathz	E:abspathz
F:/G:/abspathz//server/share/abspathz\\server2\share\abspathz
../relpath�relpath2z	good/file�goodfilez
good..filerw�good�file�G_�serverr�zC:zF:zG:z..r�C_)r�r(r5r6r#r%�writestr�sep�pardirrr�r�r�r�rfr�rr)r��srcdir�zipnamer�r(�dstdir�dstdir2s&      r"� test_unpack_archive_zip_badpaths�-TestArchives.test_unpack_archive_zip_badpaths�sj��������'�'�,�,�v�z�2���'�'�,�,�v�y�1��
�_�_�W�c�
*�
*�b��K�K���+��K�K�����(�)�4��K�K�
�I�.��K�K��i�0��K�K�
�y�1��K�K��Y�/��K�K���3��K�K�0�)�<��K�K�5�y�A��K�K��i�0��K�K��	�	�B�F�F�*�Z�7��C��K�K��Z�0��K�K��j�1�+������d�l�l�n�e�4���w�'���������r�w�w�|�|�F�F�F�'K�L�M���������r�w�w�|�|�F�L�'I�J�K����������0�1��������������V�Y�(G�H�I��������������V�T�(B�C�D��������������V�X�(F�G�H�
�7�7�d�?��O�O�B�G�G�N�N�2�7�7�<�<���i�+P�Q�R��O�O�B�G�G�N�N�2�7�7�<�<��
�+N�O�P��O�O�B�G�G�N�N�2�7�7�<�<���+L�M�N��O�O�B�G�G�N�N�2�7�7�<�<���d�I�+V�W�X��O�O�B�G�G�N�N�2�7�7�<�<��@]�+^�_�`�
�9�9������R�W�W�^�^�B�G�G�L�L���y�,Q�R�S����R�W�W�^�^�B�G�G�L�L���,K�L�M��O�O�B�G�G�N�N�2�7�7�<�<���i�+P�Q�R��������������V�R�Y�Y�
�(S�T�U��������������V�Z�(H�I�J��'�'�,�,�t�|�|�~�u�5��
�����
�
!�
!�'�
*�
*��7�B�'��O�O�B�G�G�N�N�2�7�7�<�<���+G�H�I��O�O�B�G�G�N�N�<�8�9����R�W�W�^�^�G�4�5����R�W�W�^�^�I�6�7����R�W�W�^�^�D�1�2����R�W�W�^�^�H�5�6��w�w�$����������r�w�w�|�|�D�)�/L� M�N���������}� =�>���������{� ;�<���������r�w�w�|�|�D�$�	�/R� S�T���������/L� M�N��y�y�D� �� � �����������T�9�0M�!N�O�� � ������	�!:�;���������r�w�w�|�|�D�)�/L� M�N����R�W�W�^�^�B�G�G�L�L����J�,O�P�Q����R�W�W�^�^�J�7�8�)+�
*�O+�
*�
*��N+�
*�
*�s4�1D*l�!El�6D7l�.El�l	�l	�l,	�$l,	c�`�[2oU1Qko[QQQ,UQ,2[QQ2RO[[QQ,U2[Q2[QQ,U2RO
QQ,P1[22ROQQ,P1[22[Q2RO[2U2P!)c�v:�ROU]2ROUQ2ROUQ2P!)rQ�	stuff.boo�xx)r�)r��extract_dir�extrar�s&&&�r"�_boo�/TestArchives.test_unpack_registry.<locals>._boo�s3������U�A�&����X�{�3����[�$�/r$�Booz.booz.b2r�r��Boo2)r�rQ)	rrrr�r	r
r rr�)r�r�r�sf  r"�test_unpack_registry�!TestArchives.test_unpack_registry�s����$�&��	0�
	�u�v�u�o�t�l�^�L��{�D�)�	
���-�)?��!�(�D�	*�	!��'��v��x��6��
�
�v��x��,�.@�.B�C����%�&��2�.�0B�0D�E�	!��(����+�-�w�7r$r@)r�)6r�r�r�r�r�r�r�
requires_zlibr�rrr�r�r��whichrr)r,r/r5rGrKrXrSrarmryrr�r�r�r�r�r�r�r�r�r�r�r��requires_bz2r��
requires_zstdr��
requires_lzmar�r}r�r�r�r�rr�r�r�s@r"r�r�Os����� �"�
����'8��'8�R
����H��H�8
%�
����
������e�,�6�8�*1�8��*1�X
����%9��%9�N
����H��H�:
����
#��
#�
����
������e�,�6�8�8�8��8�0
����
������g�.�8�:�4�:��4�2F�

����-��-�6
����
����*H�I��J���*-�"-�.-�&8�
����8��8�	<�
K�)� B�.
����B��B�2M�
F�09�)�
����+��+�
����+��+�
����-��-�
����
�_�_�S�-�-���-�/Y�Z�+�[��+�
����<��<�
?9�B8�8r$r�c��`�\sQsQsn\O
\\Q2Q2Q2s\O
\	Q2\O
\\
Q2Q2Q22sQ	sUs
P!)
�TestMisci��
disk_usagez)disk_usage not available on this platformc�<�[O[OO	[
22oQFD"oUO
[V2[2J$	UOUO]2UOUO]2UOUO]2UOUOUO2UOUOUO2[O[
2P!)rA)rA�used�free)r�r
r(r5r�r�r�rr��
assertGreaterrAr�assertGreaterEqualr
)r��usagerYs&  r"�test_disk_usage�TestMisc.test_disk_usage�s����!�!�"�'�'�/�/�(�";�<��-�D��!�!�'�%�"6��<�.����5�;�;��*����5�:�:�q�)�����
�
�A�.�������U�Z�Z�8����5�;�;��
�
�3�	���(�#r$rZ�chownzrequires os.chownc	�~`�RO2o[OUQ5o[OOUQ2o[
UQ2[OV#2RO[29^tt^2[OU2PPP2RO[29^tt^2[OUQQ5PPP2RO[29^tt^2[OUQQ5PPP2RO[29^tt^2[OUQ2PPP2RO[29^tt^2[OUQ2PPP2[O2o[O2oQU1Q	kko[OV$U2UV$U2[OV$2UV$2[OV$Q5UV$2[OV%Q5UV%Q
5[OVU2UVU2[OV2UV2[OVQ5UV2[OVQ5UVQ
5[ O"U2]*o[$O&U2]*o[OV'U2UV$U2[OVU2UVU2[O*U[O,2o	RO/[O0U	2[OO3U2o
[OO3U2o[OV�VYQ5UV$U2[OV�U	Q5UV$2[OV�U	Q5UV%Q
5[OV�VYP	Q
5UV$U2[OV�VYP
Q
5UV$U2[OV4P	Q5UV$2[OV�U	P
Q5UV%Q
5[OV�VYP	Q
5UV$U2RO[29^tt^2[OV$UQ5PPP2RO[429^tt^2[OQVEU	Q5PPP2RO[29^tt^2[OV)Q5PPP2P!)%fhCK�9h)%fhCK�9h)%fhCK�9h)%fhCKz9h)%fhCKQ9h[(cCK�h9h)%fhCK9h)%fhK�9h)%fhP!9h)r��
chown_linkztesting chown functionznon-existing username)�userznon-existing groupname)rP�spamg��Q�	@c�:�[OU2oUdROVO2UdROV#O2P!P!r')r(rr��st_uid�st_gid)r5r]r^�sr�s&&& �r"�check_chown�(TestMisc.test_chown.<locals>.check_chown	sC�������
�A���� � ��h�h�/���� � ��h�h�/�r$)r^r�)rPr�)r�rGrF)rPr�rG�missingfile)NN)r�ror�r(r5r6r=r�r�rJr�r�LookupErrorr��getuid�getgidrVrWrTrU�KeyErrorr9r_r�rVrfr�)r�r�r��linknamer]r^rrrP�dirfdrf�baselinknamesf           r"�
test_chown�TestMisc.test_chown	s����,�,�.���?�?�w�/���7�7�<�<���6���H�6�7�
�
�
�8�&�
�
�
�z�
*�
*��L�L��"�+��
�
�{�
+�
+��L�L��(?�@�,��
�
�{�
+�
+��L�L��)A�B�,��
�
�y�
)�
)��L�L��7�+�*��
�
�y�
)�
)��L�L��4�(�*��i�i�k���i�i�k��	0�	���X�C�(��H�3�'����X�#��H�"����X�(��H�"����X�)��H�&����W�3�'��G�#�&����W�"��G�!����W�'��G�!����W�(��G�%�
	+��<�<��$�Q�'�D��L�L��%�a�(�E�

�L�L���/���s�+��L�L���.���c�*��������-��������%�(��7�7�#�#�H�-���w�w�'�'��1�����X�C�6��H�3�'����X�5�1��H�"����X��7��H�&����X�C�t�L��H�3�'����X�C�u�M��H�3�'����X�D�9��H�"����\�U�E�R��H�&����\��4�P��H�3�'�
�
�
�y�
)�
)��L�L��w�7�*��
�
�0�
1�
1��L�L����?�2��
�
�z�
*�
*��L�L��0�+�
*�e+�
*�
*��,�
+�
+��,�
+�
+��*�
)�
)��*�
)�
)��D�	��	��<*�
)�
)��2�
1��+�
*�
*�s��	V�V"�V6�W
�>W�:W2�/X�-X�,X+�V	�V	�"V3	�+V3	�6W	�?W	�
W	�W	�W/	�'W/	�2	X�<X�X�X	�
X	�X(	�!X(	�+X<	�4X<	r@)r�r�r�r�r�r�rnr�rrSr(r&r�r�r�s@r"r	r	�ss����
������6�D�F�$�F�$�����*H�I�
�����W�-�/B�C�Z1�D�J�Z1r$r	c�2`�\sQsQsnQs\\O2sQs	Qs
QsQsQs
\O\O"Q6gQ	2Q
2s\O\O"Q6HQ2Q2s\O\O"Q6HQ2Q
2s\O,Q2sQsQs\O\O"Q6HQ2Q2sQsQsQsQsQsQs \O\O"Q6HQ2Q2s!\O\O"Q6HQ2Q2s"\O\O"Q6HQ2Q2s#\O\O"Q6HQ2Q2s$\O\O"Q6HQ2Q2s%\O\O"Q6HQ2Q2s&\O\O"Q6HQ2Q 2s'\O\O"Q6HQ2Q!2s(\O\O"Q6HQ2Q"2s)\O\O"Q6HQ2Q#2s*\O\O"Q6HQ2Q$2s+Q%s,Us-P!)&�	TestWhichi_	c��UOQQ5o[OOU[Q*2o[O
U2[OOU[Q*2Um[O
UO2[OOU[Q*2Um[O
UO2[Q*Um[OOUOUO2Um	UOUO2UOUm[OUmQUm
P!)�Tmp)r�z-basedirz-dirz-dir2z.Exez.EXE)r�r(r5r6rr�rl�	other_dirr��filepathr=�env_pathr
�ext)r��temp_dirr3s&  r"�setUp�TestWhich.setUpb	s����<�<�u�<�-���7�7�<�<��&�:�*=�>��
������7�7�<�<��&�6�/�:���
������������h���0@�A���
������ ��V�O��	������T�X�X�t�y�y�9��
�������'�����
��i�i�����r$c�L�[U2[OUQ2P!)��)r=r(r)r�r5s&&r"r=�TestWhich.create_fileu	s���D��
����u�r$c��UO[OOU2[OOU22P!r')r�r(r5�normcase)r�r�r�s&&&r"�assertNormEqual�TestWhich.assertNormEqualy	s0��������)�)�&�1�2�7�7�3C�3C�H�3M�Nr$c��[OUOUOQ5oUO	VO
2P!�r�)r�rr�rlr�r-�r�r+s& r"�
test_basic�TestWhich.test_basic|	s,��
�\�\�$�)�)�$�(�(�
3������]�]�+r$c��[OUOUOQ5oUO	VO2P!r;)r�rr-r,r�r<s& r"�test_absolute_cmd�TestWhich.test_absolute_cmd�	s.���\�\�$�-�-�d�n�n�
=������]�]�+r$c�f�[OOUO2vq[OO	V O
2o[OUQ59^tt^2[OV0OQ5oUOVC2PPP2[OUOQ59^tt^2[OV1Q5oUOU2PPP2P!)%fhKl9h)%fhP!9hr;)
r(r5r�rlr6r�rrr�rr,r��assertIsNone)r�r3�tail_dirrr+s&    r"�test_relative_cmd�TestWhich.test_relative_cmd�	s��� �W�W�]�]�4�8�8�4����'�'�,�,�x���3��
�
!�
!�x�
0�
0����g�N�N�;�B����R�)�1��
!�
!�t�x�x�
0�
0����g�5�B����b�!�1�
0�	1�
0��1�
0�
0�s$�53D�)D�D	�D	�D0	�(D0	r�ztest is for non win32c��[OUOQ59^tt^2[OUO
UOQ5oUOU2PPP2P!)%fhP!9hr;)rrrlr�rr�r,rCr<s& r"�test_cwd_non_win32�TestWhich.test_cwd_non_win32�	sN���
!�
!�t�x�x�
0�
0����d�i�i�d�n�n�=�B����b�!�1�
0�
0�
0�s�>A3�3B	�<B	ztest is for win32c�T�[OOUO2o[O
UOQ59^tt^2[OOQP	Q59^tt^2[OUOUOQ5oUOU[OOUOUO22PPP2[OOQP
Q59^tt^2[OUOUOQ5oUO!U2PPP2PPP2P!)%fhK�9h)%fhK-9h)%fhP!9h)r��shutil._win_path_needs_curdir��return_value)r(r5r�rlrrr�r6r7r�rr�r,r�r6r
rC)r�r3r+s&  r"�test_cwd_win32�TestWhich.test_cwd_win32�	s����7�7�?�?�4�8�8�,��
�
!�
!�t�x�x�
0�
0����$�$�%D�SW�$�X�X��\�\�$�)�)�$�.�.�A��� � ��R�W�W�\�\�$�+�+�t�y�y�%I�J�Y����$�$�%D�SX�$�Y�Y��\�\�$�)�)�$�.�.�A���!�!�"�%�Z�1�
0�X�X��Z�Y��1�
0�
0�sO�*F�>A1E0	�/1F� >F	�F�0F
�9F
�;F�F
�F
�F�F'	�F'	c���[OOUOUO2oUOU2[OOQP	Q59^tt^2[OUOQ59^tt^2[OUOUOQ5oUOU[OOUOUO22PPP2[OUOQ59^tt^2[OUOUOQ5oUOU[OOUOUO22PPP2PPP2P!)%fhK�9h)%fhK-9h)%fhP!9h)rKrLr�)r(r5r6r,r�r=r�r6r7rrrlr�rr�r
)r��other_file_pathr+s&  r"�*test_cwd_win32_added_before_all_other_path�4TestWhich.test_cwd_win32_added_before_all_other_path�	s#���'�'�,�,�t�~�~�t�y�y�A������)�
�]�]�
 �
 �!@�t�
 �
T�
T��%�%�4�8�8�4�4��\�\�$�)�)�$�.�.�A��� � ��R�W�W�\�\�$�+�+�t�y�y�%I�J�5��%�%�4�>�>�:�:��\�\�$�)�)�$�(�(�;��� � ��R�W�W�\�\�$�+�+�t�y�y�%I�J�;�	U�
T�4�4��;�:��	U�
T�
T�sP�0*G%�A1F?	�1G%�<A1G	�-G%�?G
�G
�
G%�G"
�G"
�G%�%G6	�.G6	c��[OUO[O2[O
UO[O2%cUOQ2[OUOUO[OQ5oUOU2P!)zcan't set the file read-only�r5r[)
r(rr-rr�access�W_OKrr�rr�rlrCr<s& r"�test_non_matching_mode� TestWhich.test_non_matching_mode�	sl��	���������-�
�9�9�T�]�]�B�G�G�,�,��M�M�8�9�
�\�\�$�)�)�$�(�(����
A�����"�r$c	��[OOUO2vq[O
UQ59^tt^2[OUOUQ5oUOU[OOV O22PPP2P!)%fhP!9hr;)r(r5r�rlrrr�rr�r�r6)r�r3rDr+s&   r"�test_relative_path�TestWhich.test_relative_path�	sp���W�W�]�]�4�8�8�4���
�
!�
!�x�
0�
0����d�i�i�h�7�B����R������h�	�	�!B�C�1�
0�
0�
0�s�AB2�2C	�;C	c�n�[OQUOQ5oUOU2P!)zfoo.exer�)r�rrlrCr<s& r"�test_nonexistent_file�TestWhich.test_nonexistent_file�	s$��
�\�\�)�$�(�(�
3�����"�r$zpathext check is Windows-onlyc���[OUOPQUOQ5oUO	VO
PQUO*2P!)Nr����)r�rr�rlr�r-r/r<s& r"�test_pathext_checking�TestWhich.test_pathext_checking�	sD��
�\�\�$�)�)�C�R�.�t�x�x�
8������]�]�3�B�/�$�(�(�:�;r$c��[O29^tt^2oUOUQ$[OUO
2oUO
V O2PPP2P!)%fhP!9h��PATH)r�EnvironmentVarGuardr.r�rr�r�r-�r��envr+s&  r"�test_environ_path�TestWhich.test_environ_path�	sS��
�
*�
*�
,�
,���-�-�C��K����d�i�i�(�B����R���/�-�
,�
,�
,�s�AA4�4B	�=B	c
��[O29^tt^2oPUQ$[OO	QUO
P	Q59^tt^2[O[QUO
29^tt^2[OUO
29^tt^2[OUO2oUOU2PPP2PPP2PPP2PPP2P!)%fhK*9h)%fhK59h)%fhK@9h)%fhP!9h)�rf�
os.confstr�rM�create�defpath)rrgr�r6r7rlrrZr(rr�rr�rCrhs&  r"�test_environ_path_empty�!TestWhich.test_environ_path_empty�	s���
�
*�
*�
,�
,���C��K����$�$�\����,0�%�2�2��"�"�2�y�$�(�(�;�;��%�%�d�h�h�/�/��\�\�$�)�)�,���!�!�"�%�0�<�2�-�
,�
0�/��<�;��2�2��-�
,�
,�sk�:D>�/D+	�)D
�12D�#D
�+D+	�3D>�D�D�D
�D(�!D(�#D+	�+D;
�4D;
�6D>�>E	�E	c
��UOo[OQ6Xc+[OOUOU2o[O29^tt^2o[OUQ$[OOQUOP	Q59^tt^2[O[QUO29^tt^2[ O"UO2oUO%U2[O&UO29^tt^2[ O"UO2oUO)V12PPP2PPP2PPP2PPP2P!)%fhK*9h)%fhK59h)%fhK@9h)%fhP!9h)r�rfrnrorq)r�r~r�r(r5r6r
rrg�pathsepr�r6r7rlrrZr�rrCrr�)r��expected_cwdrir+s&   r"�test_environ_path_cwd�TestWhich.test_environ_path_cwd�	s&���y�y���<�<�7�"��7�7�<�<����\�B�L��
*�
*�
,�
,���*�*�C��K����$�$�\����,0�%�2�2��"�"�2�y�$�(�(�;�;��\�\�$�)�)�,���!�!�"�%��)�)�$�(�(�3�3����d�i�i�0�B��$�$�R�6�4�<�2�-�
,�4�3��<�;��2�2��-�
,�
,�sn�*AG�2/F5	�!AF"
�;2F�-F"
�5F5	�=G�F�F�F"
�"F2�+F2�-F5	�5G
�>G
�G�G	�G	c��[O29^tt^2oUQ[OO	Q[
P	Q59^tt^2[O[QUO29^tt^2[OUO2oPPP2PPP2UOWUO2[OO	QUOP	Q59^tt^2[O[QP29^tt^2[OUO2oPPP2PPP2UOV O2PPP2P!)%fhK�9h)%fhK�9h)%fhKc9h)%fhKn9h)%fhP!9h)rfrn)rrprqro)rrgr�r6r7rJrrZr(rlr�rr�r�r-rhs&  r"�test_environ_path_missing�#TestWhich.test_environ_path_missing�	s4��
�
*�
*�
,�
,���F�����$�$�\�z�,0�%�2�2��"�"�2�y�$�(�(�;�;��\�\�$�)�)�,��<�2�
���R����/����$�$�\����,0�%�2�2��"�"�2�y�"�5�5��\�\�$�)�)�,��6�2�
���R���/�-�
,�<�;��2�2��6�5��2�2��-�
,�
,�s��2G�/F	�!E<
�!F	�)AG�%F5	�&!F"
�F5	�#G�<F�F�F	�F
�F
�G�"F2�+F2�-F5	�5G
�>G
�G�G	�G	c	���[OOUO2o[O
UOQ59^tt^2[O29^tt^2oUOUQ$[OUOPQ5oUOU2PPP2PPP2P!)%fhK9h)%fhP!9h)r�rf)r(r5r�rlrrrgr.r�rr�rC)r�r3rir+s&   r"�test_empty_path�TestWhich.test_empty_path

s����7�7�?�?�4�8�8�,��
�
!�
!�t�x�x�
0�
0�
�
*�
*�
,�
,���-�-�C��K����d�i�i�b�1�B����b�!�-�1�
0�
,�
,��1�
0�
0�s1�C�2AC	�5C�C
�C
�C�C+	�#C+	c���[O29^tt^2oUQ[OUO2oUOU2PPP2P!)%fhP!9hre)rrgr�rr�rCrhs&  r"�test_empty_path_no_PATH�!TestWhich.test_empty_path_no_PATH
sI��
�
*�
*�
,�
,���F�����d�i�i�(�B����b�!�-�
,�
,�
,�s�5A�A/	�'A/	ztest specific to Windowsc	��QoUO[2oV OU2*o[OO	UO
U2oUO
U2[O29^tt^2oVQ$UO[OV O
Q5U2UO[OV0O
Q5U2PPP2P!)%fhP!9h)�.xyz�PATHEXTr���to_text_typerr(r5r6rlr=rrgr�r�r�r�r/�cmd�cmdextr-ris&     r"�test_pathext�TestWhich.test_pathext
s���������(���(�(��-�-���7�7�<�<����&�1������"�
�
*�
*�
,�
,�� �	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�(�K�-�
,�
,�
,���A'C9�9D
	�D
	c	�*�QoUO[2oV OU2*o[OO	UO
U2oUO
U2[O29^tt^2oUQ*UQ$UO[OV O
Q5U2UO[OV0O
Q5U2PPP2P!)%fhP!9h)r��;r�r�r�r�s&     r"�test_pathext_with_empty_str�%TestWhich.test_pathext_with_empty_str%
s���������(���(�(��-�-���7�7�<�<����&�1������"�
�
*�
*�
,�
,�� �3�Y�C�	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�(�K�-�
,�
,�
,�s�A/D�D	�
D	c	��QoUO[2oV OU2*o[OO	UO
U2oUO
U2[O29^tt^2oVQ$UO[OV O
Q5U2UO[OV0O
Q5U2PPP2P!)%fhP!9h)z.foo.barr�r�r�r�s&     r"�$test_pathext_with_multidot_extension�.TestWhich.test_pathext_with_multidot_extension1
s���������(���(�(��-�-���7�7�<�<����&�1������"�
�
*�
*�
,�
,�� �	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�(�K�-�
,�
,�
,�r�c	��UO[2oVOQ2*o[OO	UO
U2oUO
U2[O29^tt^2oQUQ$UO[OVO
Q52UO[OV O
Q52QUQ$UO[OVO
Q5U2UO[OV O
Q5V0OQ2*2QUQ$UO[OVO
Q5U2UO[OV O
Q5V0OQ2*2PPP2P!)%fhP!9h)r�r�r�r�z.xyz;.z.xyz;..)
r�rr(r5r6rlr=rrgrCr�rr�)r�r��cmddotr-ris&    r"� test_pathext_with_null_extension�*TestWhich.test_pathext_with_null_extension=
sT������(���(�(��-�-���7�7�<�<����#�.������"�
�
*�
*�
,�
,��#�C�	�N����f�l�l�3�X�X�>�?����f�l�l�6���A�B�%�C�	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�%�(9�(9�#�(>�>�
@�&�C�	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�%�(9�(9�#�(>�>�
@�-�
,�
,�
,�s�EG.�.G?	�7G?	c	�(�QoUO[2oV OU2*oUOQ2o[OO	UO
U2oUO
U2[O29^tt^2oUQ*UQ$UO[OV O
Q5U2UO[OV0O
Q5U2UO[OV$*UO
Q52UO[OV4*UO
Q52PPP2P!)%fhP!9h)r�r�r�r�)
r�rr(r5r6rlr=rrgr�r�rrC)r�r/r�r��dotr-ris&      r"�$test_pathext_extension_ends_with_dot�.TestWhich.test_pathext_extension_ends_with_dotP
s��������(���(�(��-�-������$���7�7�<�<����&�1������"�
�
*�
*�
,�
,�� �3�Y�C�	�N����V�\�\�#�H�H�=�x�H����V�\�\�&�x�x�@�(�K����f�l�l�3�9�4�8�8�D�E����f�l�l�6�<�d�h�h�G�H�-�
,�
,�
,�s�CF�F	�	F	c�4�QoUO[2oV OU2*o[OO	UO
U2oUO
U2[O29^tt^2o[OUO
2UQ$VQ$UO[OU2U2UO[OU2U2PPP2P!)%fhP!9h)r�rfr�)
r�rr(r5r6rlr=rrg�fsdecoder�r�rr�s&     r"�%test_pathext_applied_on_files_in_path�/TestWhich.test_pathext_applied_on_files_in_path`
s���������(���(�(��-�-���7�7�<�<����&�1������"�
�
*�
*�
,�
,���+�+�d�h�h�/�C��K� �	�N����V�\�\�#�.��9����V�\�\�&�1�8�<�	-�
,�
,�
,�s�A4D�D	�D	c��[OOQP	Q59^tt^2oUO[O
Q[O22UOQ2UO2UO[O
Q]22UO2PPP2[OOQP
Q59^tt^2oUO[O
Q[O22UOQ2PPP2P!)%fhK�9h)%fhP!9h)z&_winapi.NeedCurrentDirectoryForExePathrL�dontcare)r�r6r7r�r��_win_path_needs_curdirr(�X_OK�assert_called_once_with�
reset_mock�assert_not_calledr�)r��need_curdir_mocks& r"�test_win_path_needs_curdir�$TestWhich.test_win_path_needs_curdirn
s���
�]�]�
 �
 �!I�X\�
 �
]�
]�aq��O�O�F�9�9�*�b�g�g�N�O��4�4�Z�@��'�'�)��O�O�F�9�9�*�a�H�I��.�.�0�^��]�]�
 �
 �!I�X]�
 �
^�
^�br����V�:�:�:�r�w�w�O�P��4�4�Z�@�_�
^�^�
]��_�
^�
^�s%�BD8�(AE�8E	�E	�E	�E	c��UOoUO[OVOQ5UO
2UO[OVO[OQ5UO
2VOQ2*o[OOUOU2oUOU2UO[OVOQ5UO
2UO[OVO[OQ5UO
2UO[OV OQ5U2UO[OV O[OQ5U2P!�r�rUz.com)r�r8r�rrlr-r(�F_OKr�r5r6r=)r�r��cmd2rQs&   r"�$test_same_dir_with_pathext_extension�.TestWhich.test_same_dir_with_pathext_extension{
s!���i�i�����V�\�\�#�H�H�=�t�}�}�M����V�\�\�#�H�H�2�7�7�K�!�]�]�	,��&�&�v�.�.���'�'�,�,�t�x�x��6������)�	
���V�\�\�#�H�H�=�t�}�}�M����V�\�\�#�H�H�2�7�7�K�!�]�]�	,����V�\�\�$�X�X�>��P����V�\�\�$�X�X�B�G�G�L�,�	.r$c���UOPQoUO[OVOQ5UO
2UO[OVO[OQ5UO
2[OOUOU2oUOU2UO[OVOQ5UO
2UO[OVO[OQ5U2UO[OUOUOQ5UO
2UO[OUOUO[OQ5UO
2P!�Nr�rUra)r�r8r�rrlr-r(r�r5r6r=)r�r�rQs&  r"�'test_same_dir_without_pathext_extension�1TestWhich.test_same_dir_without_pathext_extension�
s$���i�i���n�����V�\�\�#�H�H�=�t�}�}�M����V�\�\�#�H�H�2�7�7�K�!�]�]�	,��'�'�,�,�t�x�x��5������)�	
���V�\�\�#�H�H�=�t�}�}�M����V�\�\�#�H�H�2�7�7�K�,�	.����V�\�\�$�)�)�$�(�(�C�T�]�]�S����V�\�\�$�)�)�$�(�(����Q�!�]�]�	,r$c�p�UOo[OO[OUO
2[OUO2,2oUO[OVQ5UO2UO[OV[OQ5UO2VOQ2*o[OOUO
U2oUOU2UO[OVQ5U2UO[OV[OQ5U2UO[OV2Q5U2UO[OV2[OQ5U2[OO[OUO2[OUO
2,2oUO[OVQ5UO2UO[OV[OQ5UO2P!r�)r�r(rur6r�r,rlr8r�rr-r�r�r5r=r�)r�r��search_pathr�rQs&    r"�%test_dir_order_with_pathext_extension�/TestWhich.test_dir_order_with_pathext_extension�
s����i�i���j�j�o�o�r�{�{�4�>�>�'B�')�{�{�4�8�8�'<�'>�?��	
���V�\�\�#�@�$�-�-�P����V�\�\�#�b�g�g�N�!�]�]�	,��&�&�v�.�.���'�'�,�,�t�~�~�t�<������)�	
���V�\�\�#�@�/�R����V�\�\�#�b�g�g�N�,�	.�	
���V�\�\�$�A�?�S����V�\�\�$�r�w�w�O�,�	.��j�j�o�o�r�{�{�4�8�8�'<�')�{�{�4�>�>�'B�'D�E��������c�<�d�m�m�L�������c�"�'�'�J����	(r$c��UOPQo[OO[OUO
2[OUO2,2oUO[OVQ5UO2UO[OV[OQ5UO2[OOUO
U2oUOU2UO[OVQ5UO2UO[OV[OQ5U2UO[OUOUQ5UO2UO[OUOU[OQ5UO2[OO[OUO2[OUO
2,2oUO[OVQ5UO2UO[OV[OQ5UO2P!r�)r�r(rur6r�r,rlr8r�rr-r�r5r=)r�r�r�rQs&   r"�(test_dir_order_without_pathext_extension�2TestWhich.test_dir_order_without_pathext_extension�
s����i�i���n���j�j�o�o�r�{�{�4�>�>�'B�')�{�{�4�8�8�'<�'>�?��	
���V�\�\�#�@�$�-�-�P����V�\�\�#�b�g�g�N�!�]�]�	,��'�'�,�,�t�~�~�s�;������)�	
���V�\�\�#�@�$�-�-�P����V�\�\�#�b�g�g�N�,�	.�	
���V�\�\�$�)�)�+�F��
�
�V����V�\�\�$�)�)�+�B�G�G�T�!�]�]�	,��j�j�o�o�r�{�{�4�8�8�'<�')�{�{�4�>�>�'B�'D�E�����V�\�\�#�@�$�-�-�P����V�\�\�#�b�g�g�N�!�]�]�	,r$)r
rlr.r/r�r-r,).r�r�r�r�r1�staticmethodr(r�r�r=r8r=r@rEr�r�r~r�rHrNrRrr�rXr[r^rbrjrrrwrzr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�s@r"r)r)_	s�����" ����,�L��O�,�
,�"��������0�0�2�"�2�"��������0�,�.�
&�.�
&��������0�,�.�	K�.�	K��#�#��$��D��
�������0�8�:�<�:�<�0�	&�7�&0�$"�"��������0�2L�M�	L�N�	L��������0�2L�M�	L�N�	L��������0�2L�M�	L�N�	L��������0�2L�M�@�N�@�$�������0�2L�M�I�N�I��������0�2L�M�
=�N�
=��������0�2L�M�
A�N�
A��������0�2L�M�.�N�.�&�������0�2L�M�,�N�,�(�������0�2L�M�(�N�(�:�������0�2L�M�,�N�,r$r)c�L`�\sQsQsnQs\\O2sQs	Us
P!)�TestWhichBytesi�
c���[OU2[OUO2Um[OUO
2Um[OUO2Um[OUO2Um[OUO2Um[OUO2Um	P!r')
r)r1r(r�rlr�r-r,r
r/r}s&r"r1�TestWhichBytes.setUp�
s���������;�;�t�x�x�(����K�K��	�	�*��	����D�M�M�2��
����T�^�^�4����k�k�$�+�+�.����;�;�t�x�x�(��r$)r
rlr/r�r-r,)r�r�r�r�r1r�r(r�r�r�r�r�s@r"r�r��
s����)� ����,�Lr$r�c�`�\sQsQsnQsQsQsQsQsQs	Qs
\Q	2s\Q
2s
Qs\Q2sQ
s\Q2sQs\O(\O,O.Q2Q2sQsQsQsQs\O<Q2s\O<\Q22s \O<\Q22s!\O<\Q22s"\O<\Q22s#Qs$Qs%\Q2s&\Q2s'Qs(\Q 2s)\O<Q!2s*\O<Q"2s+\OX\O(\-\Q#29%c\-\.Q$29%c
\-\.Q%2Q&2Q'22s/Q(s0Us1P!))�TestMovei�
c�H�QoUO2UmUO2Um[OOUOU2Um[OOUOU2Um[UOQ2P!)r�r)	r�r�r�r(r5r6r�r�r=)r�r�s& r"r1�TestMove.setUp�
sc�����|�|�~����|�|�~��������T�\�\�8�<��
������T�\�\�8�<��
��D�M�M�7�+r$c��[UQ29^tt^2oUO2oPPP2[OV2[UQ29^tt^2oUO	WUO22PPP2UO[OOU22P!)%fhK�9h)%fhKS9h�rT)	r9rYr��mover�r�r(r5r�)r�rvrw�real_dstrP�contentss&&&&  r"�_check_move_file�TestMove._check_move_file�
s���
�#�t�_�_���v�v�x�H�����C��
�(�D�
!�
!�Q����X�q�v�v�x�0�"����������,�-��_��"�
!�s#�B2�!C�2C	�;C	�C	�C	c�,�[[OU22o[OV2UOU[[OU222UO
[OOU22P!r')	r_r(r`r�r�r�r�r5r�)r�rvrwr�r�s&&&& r"�_check_move_dir�TestMove._check_move_dirsY���"�*�*�S�/�*�����C������6�"�*�*�X�*>�#?�@����������,�-r$c�j�UOUOUOUO2P!r')r�r�r�r}s&r"�test_move_file�TestMove.test_move_files �����d�m�m�T�]�]�D�M�M�Jr$c�j�UOUOUOUO2P!r')r�r�r�r�r}s&r"�test_move_file_to_dir�TestMove.test_move_file_to_dirs �����d�m�m�T�\�\�4�=�=�Ir$c�~�[UO2oUOVOUO2P!r')rr�r�r�r�)r�rvs& r"�"test_move_file_to_dir_pathlike_src�+TestMove.test_move_file_to_dir_pathlike_srcs(���t�}�}�%�����c�<�<����?r$c�~�[UO2oUOUOVO2P!r')rr�r�r�r��r�rws& r"�"test_move_file_to_dir_pathlike_dst�+TestMove.test_move_file_to_dir_pathlike_dsts(���t�|�|�$�����d�m�m�S�-�-�@r$c�(�UO2P!r')r�r}s&r"�test_move_file_other_fs� TestMove.test_move_file_other_fss��	
���r$c�(�UO2P!r')r�r}s&r"�test_move_file_to_dir_other_fs�'TestMove.test_move_file_to_dir_other_fss��	
�"�"�$r$c���[OUO2Q5oUOUOV2[
OU2P![
OS2h9hrg)ror�r�r�r�rr��r�r�s& r"�
test_move_dir�TestMove.test_move_dir#sL���/�/�d�l�l�n�5��	&�� � ����w�@����W�%��I���W�%�s�A�A4c�(�UO2P!r')r�r}s&r"�test_move_dir_other_fs�TestMove.test_move_dir_other_fs+s��	
���r$c
���UOUOUO[OOUO[OO
UO222P!r')r�r�r�r(r5r6rfr}s&r"�test_move_dir_to_dir�TestMove.test_move_dir_to_dir0sF�����T�\�\�4�<�<��G�G�L�L����r�w�w�'7�'7����'E�F�	Hr$c�(�UO2P!r')r�r}s&r"�test_move_dir_to_dir_other_fs�&TestMove.test_move_dir_to_dir_other_fs5s��	
�!�!�#r$c
�2�UOUO[OO*UO
[OO
UO
[OOUO222P!r')r�r�r(r5r�r�r6rfr}s&r"�test_move_dir_sep_to_dir�!TestMove.test_move_dir_sep_to_dir:sS�����T�\�\�B�G�G�K�K�7�����G�G�L�L����r�w�w�'7�'7����'E�F�	Hr$zrequires os.path.altsepc
�2�UOUO[OO*UO
[OO
UO
[OOUO222P!r')r�r�r(r5�altsepr�r6rfr}s&r"�test_move_dir_altsep_to_dir�$TestMove.test_move_dir_altsep_to_dir>sS�����T�\�\�B�G�G�N�N�:�D�L�L��G�G�L�L����r�w�w�'7�'7����'E�F�	Hr$c��[UO2UO[O[O
UOUO2P!r')r=r�r�r�rr�r�r�r}s&r"�"test_existing_file_inside_dest_dir�+TestMove.test_existing_file_inside_dest_dirCs2���D�M�M�"����&�,�,����T�]�]�D�L�L�Qr$c���[OOUOQ2oUO	[
O[
OUOU2P!�r;)r(r5r6r�r�r�rr�r�s& r"�test_dont_move_dir_in_itself�%TestMove.test_dont_move_dir_in_itselfHs:���g�g�l�l�4�<�<��/�����&�,�,����T�\�\�3�Gr$c
��[O[2QFD}vq[OO	[U2o[OO	[U2oUO[OV2QU8QU8Q0Q5J	[O[2P![O[2h9h)r��)_destinsrc() wrongly concluded that dst (z) is not in src (�)�rF))r�zsrcdir/dest)
r(r�rr5r6r�r��
_destinsrcrr�rps&  r"�test_destinsrc_false_negative�&TestMove.test_destinsrc_false_negativeMs���
�����	%�7����g�g�l�l�6�3�/���g�g�l�l�6�3�/������ 1� 1�#� ;�>A�3�"H� �I�8�
���V�$��I���V�$���BB=�=Cc
��[O[2QFD}vq[OO	[U2o[OO	[U2oUO[OV2QU8QU8Q0Q5J	[O[2P![O[2h9h)r�r�z
) is in src (r�r�))r�zsrc/dest)r�z
srcdir.new)
r(r�rr5r6r�r�rrr�rps&  r"�test_destinsrc_false_positive�&TestMove.test_destinsrc_false_positiveYs���
�����	%�N����g�g�l�l�6�3�/���g�g�l�l�6�3�/��� � ��!2�!2�3�!<�9<�c�!C�!�D�O�
���V�$��I���V�$�rc��UO2o[OOUQ2o[OU2[OOUQ2o[O
V2[OOUQQ2oUO
[OV$2QU8QU8Q0Q5P!)rvr�r�z<_destinsrc failed to detect dst inside src via symlink (dst=z, src=r�r�)	r�r(r5r6r�r�r�r�r)r�r�rvr�rws&    r"�test_destinsrc_symlink_bypass�&TestMove.test_destinsrc_symlink_bypasses����l�l�n���g�g�l�l�3��&��
���C���w�w�|�|�C��(��
�
�
�3���g�g�l�l�4���.��������c�'�&)�3�0�	�	
r$c���[OOUOQ2o[OUO
U2[OVO2UO[OOUO22UO[OOUO
UO22P!r�)r(r5r6r�r�r�r�r�r�r�rb�samefiler�s& r"�test_move_file_symlink�TestMove.test_move_file_symlinkvs����g�g�l�l�4�<�<��/��
�
�
�4�=�=�#�&����C���'���������t�}�}�5�6�������(�(�����
�
�F�Gr$c��Qo[OOUOU2o[OUO
U2[OV O2[OOUOU2oUO[OOU22UO[OOUO
U22P!r�)r(r5r6r�r�r�r�r�r�r�rbr)r�r�rw�
final_links&   r"�test_move_file_symlink_to_dir�&TestMove.test_move_file_symlink_to_dirs������g�g�l�l�4�<�<��2��
�
�
�4�=�=�#�&����C���&��W�W�\�\�$�,�,��9�
���������z�2�3�������(�(����
�C�Dr$c�P�[OOUOQ2o[OOUOQ2o[OV2[OOUO
Q2o[OV#2UO[OOU22UO[OOU2[OOU22P!�r<r;r=)r(r5r6r�r�r�r�r�r�rbr��realpath�r�rvrwr�s&   r"�test_move_dangling_symlink�#TestMove.test_move_dangling_symlink�s����g�g�l�l�4�<�<��/���g�g�l�l�4�<�<��/��
�
�
�3���7�7�<�<����f�5�����C�"���������x�0�1�������)�)�#�.����0@�0@��0J�Kr$c�@�[OOUOQ2o[OOUOQ2o[OU2[O
V2[OOUOQ2o[OV#2UO[OOU22UO[OOV22P!r)r(r5r6r�r�r�r�r�r�r�rbrrs&   r"�test_move_dir_symlink�TestMove.test_move_dir_symlink�s����g�g�l�l�4�<�<��/���g�g�l�l�4�<�<��/��
����
�
�
�
�3���7�7�<�<����f�5�����C�"���������x�0�1�������(�(��7�8r$c	� �[OUOUO2oUO	U[
OOUO[
OOUO222P!r')	r�r�r�r�r�r(r5r6rfr<s& r"�test_move_return_value�TestMove.test_move_return_value�sT��
�[�[�������
5�����������T�\�\�2�7�7�+;�+;�D�M�M�+J�K�	Mr$c��[OUO[OOUOQ22oUOU[OOUOQ22P!r�)r�r�r�r(r5r6r�r�r<s& r"� test_move_as_rename_return_value�)TestMove.test_move_as_rename_return_value�sL��
�[�[���������T�\�\�5�(I�
J������R�W�W�\�\�$�,�,��>�?r$c�`�,nU1Qko[OUOUOUQ5UO	[R2]2P!)c�.:�ROV12P!r'r��rvrw�moveds&&�r"r�7TestMove.test_move_file_special_function.<locals>._copy������L�L�#��$r$r�)r�r�r�r�r�r��r�rr$s& @r"�test_move_file_special_function�(TestMove.test_move_file_special_function�s9�����	%����D�M�M�4�<�<�u�E�����U��Q�'r$c�`�,nU1Qko[O[OO	UO
Q22[O[OO	UO
Q22[OUO
UOUQ5UO[R2]2P!)c�.:�ROV12P!r'r�r#s&&�r"r�6TestMove.test_move_dir_special_function.<locals>._copy�r&r$r��child1r�)rrr(r5r6r�r�r�r�r�r�r's& @r"�test_move_dir_special_function�'TestMove.test_move_dir_special_function�s{�����	%��#�#�B�G�G�L�L����w�$G�H��#�#�B�G�G�L�L����x�$H�I����D�L�L�$�,�,�e�D�����U��Q�'r$c�d�UO2Um[OO	[OOUO2[OO
UO2O22oUOUOU2[OUOU2UO[OOU22[OU2P![OS2h9hr')r�r�r(r5r6r�rf�upperr?r�r�r�rar�r�s& r"�test_move_dir_caseinsensitive�&TestMove.test_move_dir_caseinsensitive�s����|�|�~����'�'�,�,���������-���� � ����.�4�4�6�8��	
���D�L�L�'�2�	��K�K����g�.��O�O�B�G�G�M�M�'�2�3��H�H�W���B�H�H�W��s
�0AD�D/c��[OOUOQ2o[OOUOQ2o[O
UOUP	Q5[OV!2UO[OOU22UO[OOUOU22UO[OOU22[O
UOUP	Q5UO[O29^tt^2[OV!2PPP2UO[OOUOU22UO[OOU22P!)%fhKy9h)�	linktodirr%)r(r5r6r�r�r�r�r�r�rbrr�r�r�r)r�rwrvr�s&&  r"�"_test_move_symlink_to_dir_into_dir�+TestMove._test_move_symlink_to_dir_into_dir�s&���g�g�l�l�4�<�<��5���7�7�<�<����k�:��
�
�
�4�<�<��$�?����C����������x�0�1�������(�(����x�@�A����������,�-�	�
�
�4�<�<��$�?�
�
�
�v�|�|�
,�
,��K�K��!�-�������(�(����x�@�A���������s�+�,�-�
,�s�.G6�6H	�?H	c�>�UOUO2P!r')r6r�r}s&r"�!test_move_symlink_to_dir_into_dir�*TestMove.test_move_symlink_to_dir_into_dir�s���/�/����=r$c���[OOUOQ2o[OUO
UP	Q5UO
U2P!)�otherlinktodirr%)r(r5r6r�r�r�r6r�s& r"�,test_move_symlink_to_dir_into_symlink_to_dir�5TestMove.test_move_symlink_to_dir_into_symlink_to_dir�s=���g�g�l�l�4�<�<�)9�:��
�
�
�4�<�<��$�?��/�/��4r$r��SF_IMMUTABLE�	UF_OPAQUEzrequires lchflagsc�x�[O[2[O[[O
2UO
[[O[[2UO[[O272[O[[O2[O[O O#[Q22[O[[O
2UO
[[O[[2UO[[O272[O O%[2%cD[O[[O2[O&[2[O O%[2%cF[O[[O2[O&[2P!P![O O%[2%cD[O[[O2[O&[2[O O%[2%cE[O[[O2[O&[2hh9h)r�)r(r��
TESTFN_SRCr�rr?r�r�r�r��
TESTFN_DSTr�r`r@rrr5r6r�r�r}s&r"�test_move_dir_permission_denied�(TestMove.test_move_dir_permission_denied�s���	-��H�H�Z� ��K�K�
�D�$5�$5�6�
���o�v�{�{�J�
�S����Z�2�:�:�<�7�8�
�K�K�
�D�N�N�3��'�'������Z��(I�J��K�K�
�D�$5�$5�6�
���o�v�{�{�J�
�S����Z�2�:�:�<�7�8��w�w�~�~�j�)�)����J����7�� � ��,��w�w�~�~�j�)�)����J����7�� � ��,�*���w�w�~�~�j�)�)����J����7�� � ��,��w�w�~�~�j�)�)����J����7�� � ��,�*�s�E?I�)L9�A+L9�4AL9)r�r�r�r�)2r�r�r�r�r1r�r�r�r�r�r�r0r�r�r�r�r�r�r�r�r�r(r5r�r�r�r�rrrr�rrrrrrrr(r.r2r6r9r=r�rnrrDr�r�r�s@r"r�r��
sZ����,�.�.�K�J�@�
A�
�����%��%�&�����H�
�$��$�H���������)B�C�H�D�H�R�
H�

%�
%��"�"�
�#�
� �"�"��H��#�H��"�"��E��#�E��"�"��L��#�L��"�"��9��#�9�M�
@��(��(��(��(��$�-��-�"�"�"�>�#�>��"�"�5�#�5�
�'�'�
�����Z�0�8�8�$�T�>�:�8�8�$�T�;�7�,�.�-�	.�(�
-r$r�c��`�\sQsQsnQQ\2sQs\O\	Q2Q2s
\O\	Q2Q2s\O\	Q2Q2sQ	s
UsP!)
�TestCopyFilei
c�J`�\sQsQsnP
sPsP
sQQksQsQs	Qs
QsUsP!)�TestCopyFile.Fauxic� �VmV mP!r')�_raise_in_exit�_suppress_at_exit)r��
raise_in_exit�suppress_at_exits&&&r"�__init__�TestCopyFile.Faux.__init__s��"/��%5�"r$c��P!)rmr@)r�r s&*r"rY�TestCopyFile.Faux.reads��r$c��P	UmP!r-)�_enteredr}s&r"�	__enter__�TestCopyFile.Faux.__enter__s	�� �D�Mr$c�v�VU1UmUO%cP	Um[Q2gUO!)T�Cannot close)�_exited_withrK�_raisedrrL)r��exc_type�exc_val�exc_tbs&&&&r"�__exit__�TestCopyFile.Faux.__exit__s9�� (�6� 9�D���"�"�"�#����n�-�-��)�)�)r$)rTrYrKrZrLr�)
r�r�r�r�rTrYrZrOrYrUr^r�r�r�s@r"�FauxrIs-����������	6�	�	!�	*�	*r$r`c	�4�QQko[O[QU29^tt^2UO[29^tt^2[O
QQ2PPP2PPP2P!)%fhK9h)%fhP!9h)rUc�,�UQ6Xc[Q2gP!)�srcfilezCannot open "srcfile"rR)r�r[s&&r"�_open�4TestCopyFile.test_w_source_open_fails.<locals>._open"s���9�$��5�6�6�%r$r9rc�destfile�rU)rrZr�r�rr�)r�rds& r"�test_w_source_open_fails�%TestCopyFile.test_w_source_open_fails!s]��	�
�
�
�v�v�u�
5�
5��"�"�7�+�+����	�:�6�,�6�
5�+�+��6�
5�
5�s/�B�	A3	�!B�3B
�<B
�>B�B	�B	zskipped on macOSc��`�UO2nQU1Qkko[O[QU29^tt^2[OQQ2PPP2UORO2UORO]*[I2UORO]*OQ2P!)%fhK�9h)rUc�@:�UQ6XcR!UQ6Xc[Q2gP!)rcrf�Cannot open "destfile"rR)r�r[rcs&&�r"rd�2TestCopyFile.test_w_dest_open_fails.<locals>._open/s)����9�$����:�%��6�7�7�&r$r9rcrfrg)rl)r`rrZr�r�r�rTrYrr�r )r�rdrcs& @r"�test_w_dest_open_fails�#TestCopyFile.test_w_dest_open_fails+s�����)�)�+��	��
�
�v�v�u�
5�
5��O�O�I�z�2�6�����(�(�)�����,�,�Q�/�7�:�;�����-�-�a�0�5�5�4�	6�	6�
5�s�C�C!	�C!	c�Z``�UO2nUOP	2nQUU1Qkko[O[QU29^tt^2[OQQ2PPP2UORO2UORO2UORO2UORO]*[I2UORO]*OQ2P!)%fhK�9h)Tc�.:�UQ6XcR!UQ6XcR!P!�rcrfr@�r�r[rfrcs&&��r"rd�3TestCopyFile.test_w_dest_close_fails.<locals>._openB�"����9�$����:�%���&r$r9rcrfrg)rX)r`rrZr�r�r�rTrZrYrr�r �r�rdrfrcs& @@r"�test_w_dest_close_fails�$TestCopyFile.test_w_dest_close_fails=s�����)�)�+���9�9�T�?��	�	��
�
�v�v�u�
5�
5��O�O�I�z�2�6�����(�(�)�����)�)�*�����(�(�)�����,�,�Q�/�7�:�;�����-�-�a�0�5�5�*�	,�
6�
5�s�D�D*	�#D*	c	�``�UOP	2nUO2nQUU1Qkko[O[QU29^tt^2UO	[
29^tt^2[OQQ2PPP2PPP2UORO2UORO2UORO2UORO]*PI2UORO2P!)%fhK�9h)%fhK�9h)Tc�.:�UQ6XcR!UQ6XcR!P!rrr@rss&&��r"rd�5TestCopyFile.test_w_source_close_fails.<locals>._openXrur$r9rcrfrg)r`rrZr�r�rr�r�rTr�rZrYrvs& @@r"�test_w_source_close_fails�&TestCopyFile.test_w_source_close_failsRs�����)�)�D�/���9�9�;��	�	��
�
�v�v�u�
5�
5��"�"�7�+�+����	�:�6�,�6�	
����(�(�)�����)�)�*�����)�)�*�����,�,�Q�/�4�7�8�������(�
,�+��6�
5�s0�D=�0D*	�D=�*D:
�3D:
�5D=�=E
	�E
	r@)r�r�r�r��objectr`rhr�r�r�rnrwr|r�r�r�s@r"rGrG
sv����*�v�*�$7��_�_�U�.�/�6�0�6�"�_�_�U�.�/�,�0�,�(�_�_�U�.�/�)�0�)r$rGc��`�\sQsQsnQs\Q2s\Q2sQs\	OQ2sQsQs
QsQ	s\O"\O&Q
6gQ2Q2sQ
sUsP!)�TestCopyFileObjiic�<�[[UO2P!r')rRr�FILESIZE��clss&r"�
setUpClass�TestCopyFileObj.setUpClassls�������-r$c�p�[O[2[O[2P!r')rrsrrr�s&r"�
tearDownClass�TestCopyFileObj.tearDownClassps������ �����!r$c�<�[O[2P!r'�rrsrr}s&r"�tearDown�TestCopyFileObj.tearDownu�������!r$c	#�� �[[Q29^tt^2o[[Q29^tt^2oV1w�PPP2PPP2P!)%fhK9h)%fhP!9h3h�rTrE�r9rrrps&  r"�	get_files�TestCopyFileObj.get_filesx�J���
�&�$�
�
�3��g�t�$�$���j� �%� �
�$�$�� �
�
��>�A5�A!�A	�A!�
A5�A
�A
�A!�!A2	�*A2	�,	A5c	�&�[UQ29^tt^2o[UQ29^tt^2oUOUO2UO22PPP2PPP2P!)%fhK9h)%fhP!9hr�)r9r�rY)r�rvrw�fsrc�fdsts&&&  r"�assert_files_eq�TestCopyFileObj.assert_files_eq~sT��
�#�t�_�_���c�4���D�� � �����d�i�i�k�:�!��_� ����_�_�s.�A?�/A,	�A?�,A<
�5A<
�7A?�?B	�B	c���UO29^tt^2vq[OV2PPP2UO[[
2P!)%fhK,9hr')r�r��copyfileobjr�rrrps&  r"�test_content�TestCopyFileObj.test_content�s?��
�^�^�
�
��#����s�(�����V�W�-��
�s�A�A'	� A'	c��UO29^tt^2vq[OV2PPP2P!)%fhP!9hr')r�r�r�rps&  r"�test_file_not_closed�$TestCopyFileObj.test_file_not_closed�s0��
�^�^�
�
��#����s�(��
�
�
�s�=�A	�A	c�J�UO29^tt^2vq[OV2UOUO	2UO
2UOUO	2UO
2PPP2P!)%fhP!9hr')r�r�r�r��tellr�rps&  r"�test_file_offset� TestCopyFileObj.test_file_offset�sd��
�^�^�
�
��#����s�(����S�X�X�Z����7����S�X�X�Z����7��
�
�
�s�A-B�B"	�B"	r�zWindows onlyc�.�[OOQ29^tt^2o[O[
[2PPP2UOWO]*]*Q2[O[O2P
Q59^tt^2oUOQ2PPP2WOoUO[ O"U2[OOQ29^tt^2o[OU[2PPP2UOUO]*]*]2[O[O2P
Q59^tt^2oPPP2UOoUO[ O"U2[OOQ29^tt^2o[OU[2PPP2UO%U[2P!)%fhCK�9h)%fhCK�9h)%fhCK/9h)%fhK�9h)%fhKw9h)zshutil._copyfileobj_readintorksfooi)r�r6r7r�r�rrr��	call_argsrorpr(rqr:rfr�rrsr�)r��mrPrts&   r"�
test_win_impl�TestCopyFileObj.test_win_impl�s����]�]�
 �
 �!?�
@�
@�A��O�O�F�G�,�A�
	
������Q���*�O�<��
(�
(�R�Y�Y�[��
G�
G�1�
�G�G�F�O�H��������	�(�(�%�0�
�]�]�
 �
 �!?�
@�
@�A��O�O�E�7�+�A�������Q���*�A�.��
(�
(�R�Y�Y�[��
G�
G�1��H��������	�(�(�%�0�
�]�]�
 �
 �!?�
@�
@�A��O�O�E�7�+�A�	
���U�G�,�3A�
@�
@��H�
G�
G��A�
@�
@��
H�
G��A�
@�sY� H5�.I	�I�I1�9J�5I	�>I	�	I	�I	�I.	�&I.	�1J	�:J	�J	�
J	r@i )r�r�r�r�r��classmethodr�r�r��
contextlib�contextmanagerr�r�r�r�r�r�r�r(rfr�r�r�r�s@r"r�r�is������H��.��.��"��"�"����!��!�
;�
.�
"�8��_�_�R�W�W��_�n�5�-�6�-r$r�c�`�\sQsQsnQsQsQsPs\Q2s	\Q2s
Qs\OQ2sQsQ	sQ
sQsQsQ
sQsQsQsQsUsP!)�_ZeroCopyFileTesti�z#Tests common to all zero-copy APIs.r$c���[[UO2[[Q29^tt^2oUO	2UmPPP2P!)%fhP!9hr�)rRrr�r9rY�FILEDATA)r�rPs& r"r��_ZeroCopyFileTest.setUpClass�s;�������-�
�&�$�
�
�1��6�6�8�C�L� �
�
�
�s�A�A%	�A%	c�<�[O[2P!r')rrsrr�s&r"r��_ZeroCopyFileTest.tearDownClass�s������ r$c�<�[O[2P!r'r�r}s&r"r��_ZeroCopyFileTest.tearDown�r�r$c	#�� �[[Q29^tt^2o[[Q29^tt^2oV1w�PPP2PPP2P!)%fhK9h)%fhP!9h3hr�r�rps&  r"r��_ZeroCopyFileTest.get_files�r�r�c��[Q2g)zmust be implemented in subclass)r�)r�r r!s&*,r"�zerocopy_fun�_ZeroCopyFileTest.zerocopy_fun�s��!�"C�D�Dr$c��UO2UO2UO2UO2P!r')r�r�r�r1r}s&r"�reset�_ZeroCopyFileTest.reset�s*���
�
�����������
�
�r$c	��UO29^tt^2vqUOV2PPP2UO[[P	Q5UO
2UO29^tt^2vq[OOQ29^tt^2o[O[[2PPP2PPP2P!)%fhK�9h)%fhK-9h)%fhP!9h)N�rZzshutil.copyfileobj)r�r�r�r\rr�r�r6r7r�r�r)r�rvrwr�s&   r"�test_regular_copy�#_ZeroCopyFileTest.test_regular_copy�s���
�^�^�
�
��#����c�'������7�4�8�$�-�-�H�
�^�^�
�
��#����$�$�%9�:�:�a������0�;��
�	�
��
;�:���
�
�sA�C�9*C;�# C(	�C;�C%	�C%	�(C8
�1C8
�3C;�;D	�D	c	��UOUO2UO29^tt^2vqUO[[
129^tt^2UO
V2PPP2PPP2UO[[P	Q5UO2P!)%fhKE9h)%fhKP9h)Nr�)r�r�r�r�rr
r�r�r\rr�rps&  r"�test_same_file� _ZeroCopyFileTest.test_same_file�s�������
�
�#�
�^�^�
�
��#��"�"�G�->�#?�@�@��!�!�#�+�A��	
����6�$�7����G�A�@���
�s/�&B=�B*	�-B=�*B:
�3B:
�5B=�=C
	�C
	c�H�[O[O2Q5oUO	[
29^tt^2o[OUQ2PPP2UOWOOU2P!)%fhK89h)r��new)ror�r(rqr�r�r�r�r�r�r�)r�rfr�s&  r"�test_non_existent_src�'_ZeroCopyFileTest.test_non_existent_src�s`�����2�9�9�;�/��
�
�
�0�
1�
1�R��O�O�D�%�(�2�������.�.��5�2�
1�s�	B�B!	�B!	c	��``�[Q*n[Q*nUOU1Qk2UOU1Qk2[R2[RQ29^tt^2o[RQ29^tt^2oUO	V2PPP2PPP2UO[
RP	Q5Q2P!)%fhK79h)%fhKB9h)rvrwc�2:�[OR2!r'�rrs�rts�r"r��3_ZeroCopyFileTest.test_empty_file.<locals>.<lambda>�����	� 0� 0�� 9r$c�2:�[OR2!r'r��rus�r"r�r��r�r$rTrEr�r$)rr�r=r9r�r�r\�r�rvrwrurts&  @@r"�test_empty_file�!_ZeroCopyFileTest.test_empty_file�s�����5�.���5�.�����9�:����9�:��G��
�'�4�
 �
 �C��g�t�$�$���!�!�#�+�%�!�	
����7�4�8�#�>�%�$��!�
 �s0�'C�<B=	�C�=C

�C

�C�C 	�C 	c��[OOUO[Q59^tt^2UO[[O[[2PPP2P!)%fhP!9h)r)
r�r6r7�
PATCHPOINT�ZeroDivisionErrorr�r�r�rrr}s&r"�test_unhandled_exception�*_ZeroCopyFileTest.test_unhandled_exception�s_��
�]�]�
 �
 ����->�!�@�@����/�$�o�o�v�w�
@�@�@�@�@�s�/A2�2B	�;B	c���[OOUO[	[
OQ2Q59^tt^2UO29^tt^2vqUO[29^tt^2UOV2PPP2PPP2PPP2P!)%fhK"9h)%fhK-9h)%fhP!9h��yor)r�r6r7r�rr�EINVALr�r�r
r�rps&  r"�test_exception_on_first_call�._ZeroCopyFileTest.test_exception_on_first_call
s����]�]�
 �
 ����-4�U�\�\�4�-H�!�J�J����!�!�Z�c��&�&�'8�9�9��%�%�c�/�:�"�J�J�:�9��"�!��J�J�J�sN�
C�& C	�B2
�C	� C�2C�;C�=C	�C
�C
�C�C)	�!C)	c
��[OOUO[	[
OQ2Q59^tt^2UO29^tt^2vqUO[UOV2PPP2PPP2P!)%fhK9h)%fhP!9hr�)
r�r6r7r�rr�ENOSPCr�r�r�rps&  r"�test_filesystem_full�&_ZeroCopyFileTest.test_filesystem_full

s����]�]�
 �
 ����-4�U�\�\�4�-H�!�J�J����!�!�Z�c��!�!�'�4�+<�+<�c�G�"�J�J�!�!��J�J�J�s0�
B/�&$B	�
B/�B,
�%B,
�'B/�/C	�8C	r@i�)r�r�r�r��__doc__r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�s@r"r�r��s�����-� �H��H��J��5��5��!��!�"����!��!�
E�� �H�6�?�@�0�H�Hr$r�c�P`�\sQsQsnPsQsQsQsQsQs	Qs
QsQ	sUs
P!)
�_ZeroCopyFileLinuxTesti
c��[OUO29^tt^2o[[Q29^tt^2oUO[29^tt^2UOV2PPP2[OV2PPP2PPP2UO[[P	Q5UO2P!)%fhKc9h)%fhKX9h)%fhKc9h)rEr�)�io�BytesIOr�r9rr�r
r�r�r�r�r\rps&  r"�test_non_regular_file_src�0_ZeroCopyFileLinuxTest.test_non_regular_file_src
s���
�Z�Z��
�
�
&�
&�#��g�t�$�$���&�&�'8�9�9��%�%�c�/�:��"�"�3�,�%�'�	
����7�4�8�$�-�-�H�	:�9��%�$��'�
&�sM�C4�C!	�!C
�3C!	�C4�C�C�C!	�!C1
�*C1
�,C4�4D	�=D	c��[[Q29^tt^2o[O29^tt^2oUO	[
29^tt^2UO
V2PPP2[OV2UO]2UOUO2UO2PPP2PPP2P!)%fhKs9h)%fhK-9h)%fhP!9hr�)
r9rr�r�r�r
r�r�r��seekr�rYr�rps&  r"�test_non_regular_file_dst�0_ZeroCopyFileLinuxTest.test_non_regular_file_dst"
s���
�&�$�
�
�3��������&�&�'8�9�9��%�%�c�/�:��"�"�3�,������� � �����T�]�]�;�� �
�9�9����� �
�
�sM�C9�C&	�C
�(AC&	�C9�C#�C#�C&	�&C6
�/C6
�1C9�9D
	�D
	c�P``�UU1Qko,n[UO2n[OO	UOP	UQ59^tt^2UO29^tt^2vq#UO
[29^tt^2oUOV#2PPP2PPP2PPP2UOWOO[O2P!)%fhKV9h)%fhKa9h)%fhKl9h)c�~:�R%fROP2RU-U@![[OQ2g)Nr�)rcrr�EBADF)r r!r��orig_syscalls*,��r"�syscall�E_ZeroCopyFileLinuxTest.test_exception_on_second_call.<locals>.syscall,
s3�������D�!�#�T�4�V�4�4��e�k�k�4�0�0r$)rpr)
�evalr�r�r6r7r�r�rr�r�r�rr�)r�r�rvrwr�r�r�s&    @@r"�test_exception_on_second_call�4_ZeroCopyFileLinuxTest.test_exception_on_second_call+
s����	1����D�O�O�,��
�]�]�
 �
 �����-4�!�6�6����!�!�Z�c��&�&�w�/�/�2��%�%�c�/�0�"�6�	
������+�+�U�[�[�9�0�/��"�!��6�6�sN�D�/ D	�C/
�!D	�)D�/C?�8C?�:D	�D
�D
�
D�D%	�D%	c	�~�[OOQ[Q59^tt^2oUO	29^tt^2vq#UOV#2PPP2PPP2UO
[[P	Q5UO2P!)%fhKE9h)%fhKP9h)�os.fstatrr�)
r�r6r7rr�r�r�r\rr��r�r�rvrws&   r"�test_cant_get_size�)_ZeroCopyFileLinuxTest.test_cant_get_size=
sz���]�]�
 �
 ���
 �
A�
A�Q����!�!�Z�c��!�!�#�+�"�B�	
����7�4�8�$�-�-�H�"�!��B�
A�s/�B,�B	�B,�B)
�"B)
�$B,�,B<	�5B<	c	��[OO2oQUm[OO	QUQ59^tt^2oUO29^tt^2vq4UO
V42PPP2PPP2UO[[P	Q5UO2P!)%fhKE9h)%fhKP9h)ir�rLr�i)r�r6�Mock�st_sizer7r�r�r�r\rr��r�r6r�rvrws&    r"�test_small_chunks�(_ZeroCopyFileLinuxTest.test_small_chunksG
s���
�}�}�!�!�#�� ���
�]�]�
 �
 ��$�
 �
?�
?�1����!�!�Z�c��!�!�#�+�"�@�	
����7�4�8�$�-�-�H�"�!��@�
?�s0�C
�)B:	�=C
�:C

�C

�C
�
C	�C	c	���[OO2oUOQ*Um[OOQUQ59^tt^2oUO
29^tt^2vq4UOV42PPP2PPP2UO[[P	Q5UO2P!)%fhKE9h)%fhKP9h)�dr�rLr�i@)r�r6r�r�rr7r�r�r�r\rr�rs&    r"�test_big_chunk�%_ZeroCopyFileLinuxTest.test_big_chunkT
s���
�}�}�!�!�#���}�}�(9�:���
�]�]�
 �
 ��$�
 �
?�
?�1����!�!�Z�c��!�!�#�+�"�@�	
����7�4�8�$�-�-�H�"�!��@�
?�s0�!C�:C	�C�C
�C
�C�C.	�'C.	c	�:�[OOUO[Q59^tt^2oUO[[O[[2UO]*UO*oUOU[OO[22[ O"[2[%[Q2UO'[ O"[Q*2UO[[O[[Q*2UO]*UO*oUOUQ2PPP2P!)%fhP!9h)rshello�3i�)r�r6r7r�r�r�r�r�rrr��BLOCKSIZE_INDEXr�r(r5�getsizerrsr=r�)r�r��	blocksizes&  r"�test_blocksize_arg�)_ZeroCopyFileLinuxTest.test_blocksize_arga
s��
�]�]�
 �
 ����->�!�@�@�CD����/�$�o�o�v�w�
@����A��t�';�';�<�I�
���Y�������(?�@����W�%����*��O�O�I�,�,�g��m�<����/�$�o�o�w��#�
�
G����A��t�';�';�<�I����Y��0�@�@�@�@�s�EF	�	F	�F	r@)r�r�r�r�r
r�r�r�r�rrr
r�r�r�s@r"r�r�
s6�����O�I�<�:�$I�I�I�1�1r$r�zos.sendfile() not supported�_USE_CP_COPY_FILE_RANGEc�6`�\sQsQsnQs]sQsQsQsUs	P!)�TestZeroCopySendfileit
zos.sendfilec�0�[OV2!r')r��_fastcopy_sendfile�r�r�r�s&&&r"r��!TestZeroCopySendfile.zerocopy_funz
s���(�(��4�4r$c���[OOUO[	[
OQ2Q59^tt^2oUO29^tt^2vq#UO[29^tt^2[OV#2PPP2PPP2PPP2[OOUO29^tt^2o[O[[2PPP2P	[mP!)%fhK�9h)%fhK�9h)%fhK�9h)%fhKV9hP	[mh9hr�)r�r6r7r�rr�ENOTSOCKr�r�r
r�rr�rr�_USE_CP_SENDFILEr�s&   r"�test_file2file_not_supported�1TestZeroCopySendfile.test_file2file_not_supported}
s���
	+����$�$��O�O� '����� =�%�?�?�BC��^�^�%�%��#��*�*�+<�=�=��1�1�#�;�>�&�?����$�$�T�_�_�5�5�������0�6�'+�F�#�>�=��&�%��?�?��6�5��'+�F�#�s��AE(�E�' D/	�D
�D/	�&E�.9E(�' E�E(�D,�%D,�'D/	�/D?
�8D?
�:E�E	�E	�
E(�E%	�E%	� E(�(
E5r@)
r�r�r�r�r�r
r�rr�r�r�s@r"rrt
s �����J��O�5�+�+r$rz"os.copy_file_range() not supportedc�6`�\sQsQsnQs]sQsQsQsUs	P!)�TestZeroCopyCopyFileRangei�
zos.copy_file_rangec�0�[OV2!r')r��_fastcopy_copy_file_rangers&&&r"r��&TestZeroCopyCopyFileRange.zerocopy_fun�
s���/�/��;�;r$c�P``�[Q0n[Q0nUOU1Qk2UOU1Qk2[RQ29^tt^2PPP2[RQ29^tt^2o[RQ29^tt^2oUO[O
29^tt^2UO
V2PPP2PPP2PPP2P!)%fhK�9h)%fhK59h)%fhK@9h)%fhP!9h)rvrwc�2:�[OR2!r'r�r�s�r"r��;TestZeroCopyCopyFileRange.test_empty_file.<locals>.<lambda>�
r�r$c�2:�[OR2!r'r�r�s�r"r�r"�
r�r$rErT)rr�r9r�r�r
r�r�s&  @@r"r��)TestZeroCopyCopyFileRange.test_empty_file�
s�����H�C�.���H�C�.�����9�:����9�:�
�'�4�
 �
 ��!��'�4�
 �
 �C��g�t�)<�)<���"�"�6�#;�#;�<�<��!�!�#�+�=�*=�
 �
 �!�
 ��=�<��*=�)<��
 �
 �
 �s`�C�2D�(D	�/C.
�D	�	D�C+	�$C+	�.C>�7C>�9D	�D
�
D
�D�D%	�D%	r@)
r�r�r�r�r�r
r�r�r�r�r�s@r"rr�
s����%�J��O�<�,�,r$rz
macOS onlyc�,`�\sQsQsnQsQsQsUsP!)�TestZeroCopyMACOSi�
zposix._fcopyfilec�N�[OV[O2!r')r��_fastcopy_fcopyfile�posix�_COPYFILE_DATArps&&&r"r��TestZeroCopyMACOS.zerocopy_fun�
s���)�)�#�E�4H�4H�I�Ir$r@)r�r�r�r�r�r�r�r�r�s@r"r&r&�
s����#�J�J�Jr$r&c�^`�\sQsQsnQsQsQs\O\	O\OO22Q2\O2\O\\	Q2Q2Q222s\O$\O&Q	2Q
2sQsUsP!)�TestGetTerminalSizei�
c��[O2oUOUO]2UOUO]2P!)z�Check if get_terminal_size() returns a meaningful value.

There's no easy portable way to actually check the size of the
terminal, so let's check if it returns something sensible instead.
)r��get_terminal_sizer�columns�lines)r�rLs& r"�test_does_not_crash�'TestGetTerminalSize.test_does_not_crash�
s:���'�'�)��������a�0�����
�
�A�.r$c���[O29^tt^2oQUQ$UQ[O2oPPP2UO	WO
Q2[O29^tt^2oUQQUQ$[O2oPPP2UO	UOQ2P!)%fhK�9h)%fhKA9h)z.Check if environment variables have precedence�777�COLUMNS�LINES�	�888�x)rrgr�r/r�r0r1�r�rirLs&  r"�test_os_environ_first�)TestGetTerminalSize.test_os_environ_first�
s����
*�
*�
,�
,��"�C�	�N��G���+�+�-�D�-�	
������s�+�
�
*�
*�
,�
,���I�� �C��L��+�+�-�D�-�	
������S�)�-�
,��-�
,�s#�C�>C�C	�C	�C%	�C%	c�(�[O29^tt^2oQUQ$QUQ$[O2oPPP2UO	WO
]2UO	UO]2P!)%fhKJ9h)rar6�yyyr7)rrgr�r/rr0r1r;s&  r"�test_bad_environ�$TestGetTerminalSize.test_bad_environ�
sk��
�
*�
*�
,�
,��"�C�	�N� �C��L��+�+�-�D�-�	
������a�0�����
�
�A�.�-�
,�s� B�B	�
B	z
not on ttyr/zneed os.get_terminal_size()c��[OQQ,2O2O2o[W]*2[U]*21o[O29^tt^2oUOQQ2[O2oPPP2UOUW2P![[
[O1cSOQ2K�h9h)%fhK[9h)z�Check if stty returns the same results ignoring env

This test will fail if stdin and stdout are connected to
different terminals with different sizes. Nevertheless, such
situations should be pretty rare.
�sttyrLzstty invocation failedr7r6)r�r?rCr�r�r�rArr�rrg�unsetr�r/r�)r�rLr�rir�s&    r"�test_stty_match�#TestGetTerminalSize.test_stty_match�
s���	4��*�*�F�F�+;�<�C�C�E�K�K�M�D���Q��L�#�d�1�g�,�/��
�
*�
*�
,�
,���I�I�g�y�)��-�-�/�F�-�	
����6�*��"�?��-�-�/�	4��M�M�2�3�	4��
-�
,�s)�4B<�8(C3�<C0�C0�/C0�3D	�<D	zWASI has no /dev/nullc�\�[O29^tt^2oUOQQ2[O[
QP29^tt^2[OQQ5oPPP2UOWO]
2UOUO]2[[OQQQ59^tt^2o[O[
QU29^tt^2[OQQ5oPPP2PPP2UOUO]2UOUO](2PPP2P!)%fhK�9h)%fhKm9h)%fhKx9h)%fhP!9h)	r7r6�
__stdout__)�fallbackr�rVrW)�
�)�r�)rrgrDrrZr~r�r/r�r0r1r9r(�devnull)r�rirLrPs&   r"�
test_fallback�!TestGetTerminalSize.test_fallback�
s��
�
*�
*�
,�
,���I�I�g�y�)��"�"�3��d�;�;��/�/��B��<����T�\�\�2�.����T�Z�Z��,��b�j�j�#��8�8�A��"�"�3��a�8�8��/�/��B��9�9�
���T�\�\�2�.����T�Z�Z��,�-�
,�<�;��9�8��9�8��-�
,�
,�sm�7F�E!	�.A$F�%F	�7E4
�F	�AF�!E1
�*E1
�,F�4F�=F�?F	�F
�F
�F�F+	�#F+	r@)r�r�r�r�r2r<r@r�r�r(�isattyr~rHrrr�requires_subprocessrnrEr��is_wasirNr�r�r�s@r"r-r-�
s�����/�
*�/�������3�>�>�#8�#8�#:�;�\�J�� � �"�
�����%8�9�6�8�+�8�#�K�+�(�_�_�W�_�_�&=�>�-�?�-r$r-c�,`�\sQsQsnQsQsQsUsP!)�PublicAPITestsiz>Ensures that the correct values are exposed in the public API.c��UO[Q2,QNo[[Q2%f[OQ6XcUOQ2UO
[[O2[U22UO[29^tt^2]QHGoPPP2P!)%fhP!9h)�__all__�statvfsr�r
)�	ExecError)r�r�r@rTr�r�r�r�r�rr�rrrrrrr
rr�rrr/r)�
assertHasAttrr�rnr(rfrcr�r�rV�assertWarns�DeprecationWarningrX)r��
target_apirXs&  r"�test_module_all_attribute�(PublicAPITests.test_module_all_attributes������6�9�-�<�
��2�y�!�!�R�W�W��_����l�+�����V�^�^�,�c�*�o�>�
�
�
�0�
1�
1�(�2�
1�
1�
1�s�'B8�8C		�C		r@)r�r�r�r�r�r]r�r�r�s@r"rTrTs����H�)�)r$rT�__main__)r$)F)Yr��
unittest.mockr�ror~rr(�os.pathrr.r�rHrJr�r�rrrrrrrr	r
rrr
r�r#r)�ImportErrorr�r�test.supportr�test.support.os_helperrrrrBrCr�r�r�r�r}rTrVrSr�r6r7�AssertionErrorr�r#r0r=rRr\rdrz�SUPPORTS_SENDFILEr�r��TestCaser�r�r9r�r	rQr)r�r�rGr�r~r�r�r�rr�rrr&r-rTr��mainr@r$r"�<module>ris�����
��
��	�����
�
��	�6�6�6�6������"�3�
�3�,��
�f�_�
�
�f�_�
�������)��

�,�,�
!�
!�'�
*��	�l�l�2��%�������O����=�=���z�"�#>�?��A��L�	��)�$�
�&�:0�1���	�	�s"��8�,�,�s"�l^2�8�X�.�.�^2�@~?�x��*�*�~?�B]
8�8�X�.�.�]
8�@m1�x��*�*�m1�`	����,��(�+�+�,��,�D
-�Y�
-�[-�x��*�*�[-�|Y)�8�$�$�Y)�xG-�h�'�'�G-�T`H��`H�F[1�.�[1�|
���&�&�(E�F�	�������F�$=�u�E�+�1�8�3D�3D�+�F�G�+�:
���V�3�3�5Y�Z�,� 6��8I�8I�,�[�,�,
���U��L�)�J�)�8�+<�+<�J�*�J�K-�(�+�+�K-�\)�X�&�&�)�(�z���M�M�O���qo���E���"���O���
���G��sH�#M�#
M�.M#�M�	M�M�M �M �M �#M0�)M0�/M0

Youez - 2016 - github.com/yon3zu
LinuXploit