+
    Bi#                     
   ^ RI t^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
 ^ RIHt ^ RIt^ RIt^ RIt	^ RIHt  ! R R]P&                  4      t ! R	 R
]P*                  4      t]R8X  d   ]P0                  ! 4        R# R# )    N)abspath)NamespaceLoader)support)import_helperutilc                   N   a  ] tR t^t o RtRtR;t;t;tt	^t
RtR;ttR tRtV tR# )TestableTestProgramNT c                    R # N )selfs   &8/usr/lib/python3.14/test/test_unittest/test_discovery.py__init__TestableTestProgram.__init__   s        r   )__name__
__module____qualname____firstlineno__moduleexitdefaultTestfailfast
catchbreakbuffer	verbosityprogName
testRunner
testLoaderr   __static_attributes____classdictcell____classdict__s   @r   r
   r
      sA     FD377K7(7Z&IH""J r   r
   c                      a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t Rt!V t"R# ) TestDiscoveryc                   \         P                  ! 4       pR Vn        VP                  R4      pV P	                  VR4        T P                  \        4      ;_uu_ 4        TP                  R4       RRR4       R#   + '       g   i     R# ; i)/fooz/foo/bar/baz.pyzbar.bazNz/bar/baz.py)unittest
TestLoader_top_level_dir_get_name_from_pathassertEqualassertRaisesAssertionError)r   loadernames   &  r   test_get_name_from_path%TestDiscovery.test_get_name_from_path    sl    $$& &))*;<y) ~..&&}5 /...s   A::B	c                t  aaaaa \         P                  ! 4       p\        P                  oV3R  lp\        P                  P
                  oV3R lp\        P                  P                  oV3R lp. RORR..oV3R l\        n        V P                  V4       R pV\        P                  n        V P                  V4       R pV\        P                  n        V P                  V4       R Vn        VP                  oRV3R
 llpWqn	        R Vn
        \        P                  P                  R4      pWn        \        VP                  VR4      4      p	R U
u. uF  qR,           .NK  	  pp
TP                  R U
u. uF  p
RV
,          R,           .NK  	  up
4       V P!                  W4       R	# u up
i u up
i )c                     < S \         n        R # r   oslistdiroriginal_listdirs   r   restore_listdir6TestDiscovery.test_find_tests.<locals>.restore_listdir1   
    )BJr   c                  2   < S \         P                  n        R # r   r8   pathisfileoriginal_isfiles   r   restore_isfile5TestDiscovery.test_find_tests.<locals>.restore_isfile4       ,BGGNr   c                  2   < S \         P                  n        R # r   r8   rA   isdiroriginal_isdirs   r   restore_isdir4TestDiscovery.test_find_tests.<locals>.restore_isdir7       *BGGMr   ztest4.pyztest3.pyc                 &   < SP                  ^ 4      # r   poprA   
path_listss   &r   <lambda>/TestDiscovery.test_find_tests.<locals>.<lambda>=       *.."3r   c                 $    V P                  R 4      # )direndswithrA   s   &r   rJ   ,TestDiscovery.test_find_tests.<locals>.isdir@   s    ==''r   c                 H    V P                  R 4      '       * ;'       d    RV 9  # )rZ   another_dirr[   r]   s   &r   rB   -TestDiscovery.test_find_tests.<locals>.isfileE   s!    }}U++IIMT0IIr   c                     V R ,           # z moduler   r]   s   &r   rV   rW   K   	    D94Dr   Nc                 6   < S! WR 7      pW R,           .,           # patternz testsr   r   rh   baseorig_load_testss   && r   loadTestsFromModule:TestDiscovery.test_find_tests.<locals>.loadTestsFromModuleM       "6;DH,---r   c                     V # r   r   things   &r   rV   rW   R       %r   r)   test*.py module testsztest_dir.%s)ztest2.pyztest1.pyznot_a_test.pytest_dirztest.fooztest-not-a-module.pyr`   r   )test1test2ru   )test3test4)r*   r+   r8   r9   rA   rB   rJ   
addCleanup_get_module_from_namerl   
suiteClassr   r,   list_find_testsextendr.   )r   r1   r<   rE   rM   rJ   rB   rl   	top_levelsuiter2   expectedrk   rL   rD   r;   rU   s   &           @@@@@r   test_find_testsTestDiscovery.test_find_tests-   sv   $$&::	*''..	-	+J!:02
 4
(	(&	J  ''D$ 44	. &9"/GGOOF+	 )V''	:>?
 342 26O+,2 	 4&(& IM=4/?BC&( 	))	4(s   F0<F5c                  aa	a
aa \         P                  ! 4       p\        P                  oV3R  lp\        P                  P
                  o
V
3R lp\        P                  P                  o	V	3R lpR..oV3R l\        n        V P                  V4       R \        P                  n        V P                  V4       R \        P                  n        V P                  V4       R Vn        VP                  oRV3R	 llpWQn	        R
 Vn
        \        P                  P                  R4      pWan        \        VP                  VR4      4      pV P                  V. 4       R# )c                     < S \         n        R # r   r7   r:   s   r   r<   =TestDiscovery.test_find_tests_socket.<locals>.restore_listdirf   r>   r   c                  2   < S \         P                  n        R # r   r@   rC   s   r   rE   <TestDiscovery.test_find_tests_socket.<locals>.restore_isfilei   rG   r   c                  2   < S \         P                  n        R # r   rI   rK   s   r   rM   ;TestDiscovery.test_find_tests_socket.<locals>.restore_isdirl   rO   r   socketc                 &   < SP                  ^ 4      # rQ   rR   rT   s   &r   rV   6TestDiscovery.test_find_tests_socket.<locals>.<lambda>p   rX   r   c                     R # Fr   r]   s   &r   rV   r   s   s    Ur   c                     R # r   r   r]   s   &r   rV   r   v       er   c                     V R ,           # rc   r   r]   s   &r   rV   r   y   rd   r   Nc                 6   < S! WR 7      pW R,           .,           # rf   r   ri   s   && r   rl   ATestDiscovery.test_find_tests_socket.<locals>.loadTestsFromModule{   rn   r   c                     V # r   r   rp   s   &r   rV   r      rr   r   r)   rs   r   )r*   r+   r8   r9   rA   rB   rJ   rz   r{   rl   r|   r   r,   r}   r~   r.   )r   r1   r<   rE   rM   rl   r   r   rk   rL   rD   r;   rU   s   &       @@@@@r   test_find_tests_socket$TestDiscovery.test_find_tests_socket`   s     $$&::	*''..	-	+  j\
3
(*&+''D$ 44	. &9"/GGOOF+	 )V''	:>?#r   c                J  aaa	a
aaa \         P                  ! 4       p\        P                  oV3R  lp\        P                  P
                  oV3R lp\        P                  P                  o
V
3R lp. ROoS. . . .oV3R l\        n        V P                  V4       R \        P                  n        V P                  V4       V3R l\        P                  n        V P                  V4        ! R R\        4      oV3R lVn	        VP                  o	RV	3R
 llpWQn
        R Vn        RVn        \        VP                  RR4      4      pV P                  VR.RR.R..4       V P                  SP                   . RO4       V P                  SP"                  V. R3.4       R	# )c                     < S \         n        R # r   r7   r:   s   r   r<   CTestDiscovery.test_find_tests_with_package.<locals>.restore_listdir   r>   r   c                  2   < S \         P                  n        R # r   r@   rC   s   r   rE   BTestDiscovery.test_find_tests_with_package.<locals>.restore_isfile   rG   r   c                  2   < S \         P                  n        R # r   rI   rK   s   r   rM   ATestDiscovery.test_find_tests_with_package.<locals>.restore_isdir   rO   r   c                 &   < SP                  ^ 4      # rQ   rR   rT   s   &r   rV   <TestDiscovery.test_find_tests_with_package.<locals>.<lambda>   rX   r   c                     R # Tr   r]   s   &r   rV   r          Tr   c                 H   < \         P                  P                  V 4      S9  # r   r8   rA   basenamerA   directoriess   &r   rV   r          bgg&6&6t&<K&Or   c                   4   a  ] tR t^t o . t. tR tR tRtV t	R# ):TestDiscovery.test_find_tests_with_package.<locals>.Modulec                   a  VS n         S P                  P                  V4       \        P                   P	                  V4      R 8X  d   V 3R lpVS n        R# R# )test_directoryc                 f   < SP                   P                  WV34       SP                  R ,           .#  load_testsload_tests_argsappendrA   r1   testsrh   r   s   &&&r   
load_testsWTestDiscovery.test_find_tests_with_package.<locals>.Module.__init__.<locals>.load_tests   .    ,,33VG4LM $		M 9::r   NrA   pathsr   r8   r   r   r   rA   r   s   f& r   r   CTestDiscovery.test_find_tests_with_package.<locals>.Module.__init__   G     	

!!$'77##D)-==; '1DO	 >r   c                4    V P                   VP                   8H  # r   r]   r   others   &&r   __eq__ATestDiscovery.test_find_tests_with_package.<locals>.Module.__eq__       yyEJJ..r   r   rA   N
r   r   r   r   r   r   r   r   r"   r#   r$   s   @r   Moduler           E O1/ /r   r   c                    < S! V 4      # r   r   r2   r   s   &r   rV   r      	    F4Lr   Nc                 J   < S! WR 7      pW P                   R,           .,           # rg   rt   r]   ri   s   && r   rl   GTestDiscovery.test_find_tests_with_package.<locals>.loadTestsFromModule   "    "6;D;;8999r   c                     V # r   r   rp   s   &r   rV   r      rr   r   r)   ztest*a_directory module teststest_directory load_teststest_directory module teststest_directory2 module testsa_directoryr   test_directory2r   r*   r+   r8   r9   rA   rB   rJ   rz   objectr{   rl   r|   r,   r}   r~   r.   r   r   r   r1   r<   rE   rM   rl   r   r   r   rk   rL   rD   r;   rU   s   &      @@@@@@@r   test_find_tests_with_package*TestDiscovery.test_find_tests_with_package   s`   $$&::	*''..	-	+ K!2r2.
3
()&O'	/V 	/  (A$ 44	: &9"/ & V''89
 	5668:9:<	= 	M	O 	//!2w/0	2r   c                J  aaa	a
aaa \         P                  ! 4       p\        P                  oV3R  lp\        P                  P
                  oV3R lp\        P                  P                  o
V
3R lp. ROoS. . . .oV3R l\        n        V P                  V4       R \        P                  n        V P                  V4       V3R l\        P                  n        V P                  V4        ! R R\        4      oV3R lVn	        VP                  o	RV	3R
 llpWQn
        R Vn        RVn        \        VP                  RR4      4      pV P                  VR.RR.R..4       V P                  SP                   . RO4       V P                  SP"                  V. R3.4       R	# )c                     < S \         n        R # r   r7   r:   s   r   r<   WTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.restore_listdir   r>   r   c                  2   < S \         P                  n        R # r   r@   rC   s   r   rE   VTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.restore_isfile   rG   r   c                  2   < S \         P                  n        R # r   rI   rK   s   r   rM   UTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.restore_isdir   rO   r   c                 &   < SP                  ^ 4      # rQ   rR   rT   s   &r   rV   PTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.<lambda>   rX   r   c                     R # r   r   r]   s   &r   rV   r      r   r   c                 H   < \         P                  P                  V 4      S9  # r   r   r   s   &r   rV   r      r   r   c                   4   a  ] tR t^t o . t. tR tR tRtV t	R# )NTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.Modulec                   a  VS n         S P                  P                  V4       \        P                   P	                  V4      R 8X  d   V 3R lpVS n        R# R# )r   c                 f   < SP                   P                  WV34       SP                  R ,           .# r   r   r   s   &&&r   r   kTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.Module.__init__.<locals>.load_tests   r   r   Nr   r   s   f& r   r   WTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.Module.__init__   r   r   c                4    V P                   VP                   8H  # r   r]   r   s   &&r   r   UTestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.Module.__eq__   r   r   r   Nr   r$   s   @r   r   r      r   r   r   c                    < S! V 4      # r   r   r   s   &r   rV   r      r   r   Nc                 J   < S! WR 7      pW P                   R,           .,           # r   r]   ri   s   && r   rl   [TestDiscovery.test_find_tests_default_calls_package_load_tests.<locals>.loadTestsFromModule   r   r   c                     V # r   r   rp   s   &r   rV   r     rr   r   r)   rs   r   r   r   r   r   r   r   r   s   &      @@@@@@@r   0test_find_tests_default_calls_package_load_tests>TestDiscovery.test_find_tests_default_calls_package_load_tests   s`   $$&::	*''..	-	+ K!2r2.
3
()&O'	/V 	/  (A$ 44	: &9"/ & V''
;<
 	5668:9:<	= 	M	O
 	//!2z23	5r   c                  aaa	a
a \         P                  o
V
3R  lpV P                  V4       \         P                  P                  o	V	3R lpV P                  V4       \         P                  P
                  oV3R lpV P                  V4       V P                  \        P                  P                  \        R4      4       \        R4      R.\        R4      RR./oV3R lpV\         n        R	 \         P                  n        R
 \         P                  n         ! R R\        4      o\        P                  ! 4       pV3R lVn        R Vn        \        R4      Vn        \        VP!                  \        R4      R4      4      pV P#                  VR. R...4       V P#                  SP$                  RR.4       V P#                  SP&                  V. R3V. R3.4       R# )c                     < S \         n        R # r   r7   r:   s   r   r<   TTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.restore_listdir  r>   r   c                  2   < S \         P                  n        R # r   r@   rC   s   r   rE   STestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.restore_isfile#  rG   r   c                  2   < S \         P                  n        R # r   rI   rK   s   r   rM   RTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.restore_isdir'  rO   r   r)   
my_package/foo/my_package__init__.pytest_module.pyc                 (   < \        SV ,          4      # r   r}   rA   vfss   &r   list_dirMTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.list_dir9      D	?"r   c                 .    V P                  R 4      '       * # z.pyr[   r]   s   &r   rV   MTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.<lambda><      u)=%=r   c                 $    V P                  R 4      # r	  r[   r]   s   &r   rV   r
  =      dmmE&:r   c                   4   a  ] tR tRt o . t. tR tR tRtV t	R# )KTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.Modulei?  c                   a  VS n         S P                  P                  V4       VP                  R 4      '       d   V 3R lpMV 3R lpVS n        R# )test_modulec                 f   < SP                   P                  WV34       SP                  R ,           .# r   r   r   s   &&&r   r   hTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.Module.__init__.<locals>.load_testsG  r   r   c                    < SP                   P                  WV34       R p\        P                  P	                  V4      pV P                  WBR7      pSP                  R,           V.V,           # )z/foo/my_package/__init__.py	start_dirrh   r   )r   r   r8   rA   dirnamediscover)r1   r   rh   __file__this_dir	pkg_testsr   s   &&&   r   r   r  K  sj    ,,33VG4LM#@#%77??8#<$*OO&. %4 %A	 $		M 95   ) * *r   N)rA   r   r   r\   r   r   s   f& r   r   TTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.Module.__init__C  s>     	

!!$'==//;* #-r   c                4    V P                   VP                   8H  # r   r]   r   s   &&r   r   RTestDiscovery.test_find_tests_customize_via_package_pattern.<locals>.Module.__eq__V  r   r   r   Nr   r$   s   @r   r   r  ?  s     E O-&/ /r   r   c                    < S! V 4      # r   r   r   s   &r   rV   r
  Z  r   r   c                     V # r   r   rp   s   &r   rV   r
  [  rr   r   rs   zmy_package load_testsz!my_package.test_module load_testszmy_package.test_moduleN)r8   r9   rz   rA   rB   rJ   sysremover   r   r*   r+   r{   r|   r,   r}   r~   r.   r   r   )r   r<   rE   rM   r  r1   r   r   rL   rD   r;   r  s   &      @@@@@r   -test_find_tests_customize_via_package_pattern;TestDiscovery.test_find_tests_customize_via_package_pattern  s   
 ::	*(''..	-'	+&9 v()M;K+LN	#
=:	/V 	/4 $$&'@$/ ' V''DE
 	2B>?A B	C 	&(@A	C 	//!2z2!2z24	5r   c                >  a
aaa \         P                  ! 4       p\        P                  P                  o\        P                  P
                  oV3R  lpR \        P                  n        V P                  V4       \        P                  R,          oV3R lpV P                  V4       \        P                  P                  \        P                  P                  R4      4      pV P                  \        4      ;_uu_ 4        VP                  RRR7       RRR4       V P                  VP                  V4       V P                  V\        P                  4       R \        P                  n        R	 \        P                  n        V3R
 lpV P                  V4       . o
RV
3R llpWan        \"        Vn        VP                  RRR4      p\        P                  P                  R4      p\        P                  P                  R4      p	V P                  VR4       V P                  VP                  \        P                  P                  R4      4       V P                  S
V	R3.4       V P                  V\        P                  4       R#   + '       g   i     EL~; i)c                  2   < S \         P                  n        R # r   r@   rC   s   r   rE   3TestDiscovery.test_discover.<locals>.restore_isfilev  rG   r   c                     R # r   r   r]   s   &r   rV   -TestDiscovery.test_discover.<locals>.<lambda>y  r   r   NNNc                  .   < S \         P                  R &   R# r*  N)r!  rA   )orig_sys_paths   r   restore_path1TestDiscovery.test_discover.<locals>.restore_path}  s    'CHHQKr   r)   /foo/bartop_level_dirNc                     R # r   r   r]   s   &r   rV   r)        dr   c                     R # r   r   r]   s   &r   rV   r)    r   r   c                  2   < S \         P                  n        R # r   rI   rK   s   r   rM   2TestDiscovery.test_discover.<locals>.restore_isdir  rO   r   c                 .   < SP                  W34       R .# r   r   r  rh   	namespace_find_tests_argss   &&&r   r~   0TestDiscovery.test_discover.<locals>._find_tests  s    ##Y$899r   z/foo/bar/bazrh   z	['tests']r   )r*   r+   r8   rA   rB   rJ   rz   r!  r   normpathr/   ImportErrorr  r.   r,   assertInr~   strr|   )r   r1   rE   r.  	full_pathrM   r~   r   r2  r  r=  r-  rL   rD   s   &         @@@@r   test_discoverTestDiscovery.test_discoverq  s   $$&''..	- ,'	(%GGOOBGG$4$4V$<=	{++OOJfO= , 	..	:i**)	+&	 )	:F
3GGOON3	,..0GH)Y	,B+CDmSXX.7 ,++s   JJ	c                >  aaa \         P                  P                  o\         P                  P                  o\        P                  R ,          oVVV3R lpV P                  V4       R \         P                  n        R \         P                  n        \        P                  ! 4       p\        Vn	        RpRpVP                  W4R7       V P                  VP                  R4       R;Vn        pVP                  W4R7       V P                  VP                  V4       R# )	r*  c                     < S\         P                  n        S \         P                  n        S\        P                  R &   R# r,  )r8   rA   rB   rJ   r!  )rL   rD   original_sys_paths   r   restore[TestDiscovery.test_discover_should_not_persist_top_level_dir_between_calls.<locals>.restore  s&    ,BGGN*BGGM+CHHQKr   c                     R # r   r   r]   s   &r   rV   \TestDiscovery.test_discover_should_not_persist_top_level_dir_between_calls.<locals>.<lambda>  r4  r   c                     R # r   r   r]   s   &r   rV   rL    r   r   r0  r)   r1  Nz/previous/dir)r8   rA   rB   rJ   r!  rz   r*   r+   rB  r|   r  r.   r,   )	r   rI  r1   rZ   r2  dir2rL   rD   rH  s	   &     @@@r   <test_discover_should_not_persist_top_level_dir_between_callsJTestDiscovery.test_discover_should_not_persist_top_level_dir_between_calls  s    ''..HHQK	, 	 *)$$&9..5'669..5r   c                &  aa \        R 4      R.\        R4      R./oV3R lpV P                  \        \        R\        P                  4       V\        n        V P                  \        \        P
                  R\        P
                  P                  4       R \        P
                  n        V P                  \        \        P
                  R\        P
                  P                  4       R	 \        P
                  n        V P                  \        P
                  P                  \        R 4      4        ! R
 R\        4      o\        P                  ! 4       pV3R lVn        R Vn        VP                  RR R7      pV P!                  VR..4       R# )z	/toplevelstartdirz/toplevel/startdirr   c                 (   < \        SV ,          4      # r   r  r  s   &r   r  [TestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.list_dir  r  r   r9   rB   c                 $    V P                  R 4      # r	  r[   r]   s   &r   rV   [TestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.<lambda>  r  r   rJ   c                 .    V P                  R 4      '       * # r	  r[   r]   s   &r   rV   rV    r  r   c                   :   a  ] tR tRt o . t. tR tR tR tRt	V t
R# )YTestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.Modulei  c                    Wn         R # r   r]   )r   rA   s   &&r   r   bTestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.Module.__init__  s     	r   c                *    R V P                   ,           .# )zload_tests called r]   )r   r1   r   rh   s   &&&&r   r   dTestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.Module.load_tests  s    ,tyy899r   c                4    V P                   VP                   8H  # r   r]   r   s   &&r   r   `TestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests.<locals>.Module.__eq__  r   r   r]   N)r   r   r   r   r   r   r   r   r   r"   r#   r$   s   @r   r   rY    s#     E O!:/ /r   r   c                    < S! V 4      # r   r   r   s   &r   rV   rV    r   r   c                     V # r   r   rp   s   &r   rV   rV    rr   r   r1  zload_tests called startdirN)r   rz   setattrr8   r9   rA   rB   rJ   r!  r"  r   r*   r+   r{   r|   r  r.   )r   r  r1   r   r   r  s   &   @@r   ;test_discover_start_dir_is_package_calls_package_load_testsITestDiscovery.test_discover_start_dir_is_package_calls_package_load_tests  s    {#j\+,}o?	#Y

;
(BGGNNC:'277==A=)=>	/V 	/ $$&'@$/ 4KP 	789	;r   c                  aaaa \         P                  oV3R  l\         n        \         P                  P                  oR \         P                  n        \        P                  R,          oVVV3R lpV P                  V4       R# )c                 
   < S.# r   r   )_fakefiles   &r   rV   8TestDiscovery.setup_import_issue_tests.<locals>.<lambda>  s    zr   c                     R # r   r   rg  s   &r   rV   ri    s    4r   r*  c                  n   < S \         P                  n        S\         n        S\        P                  R &   R# r,  )r8   rA   rB   r9   r!  )rB   r9   r-  s   r   rI  7TestDiscovery.setup_import_issue_tests.<locals>.restore  s"    #BGGN BJ'CHHQKr   N)r8   r9   rA   rB   r!  rz   )r   rh  rI  rB   r9   r-  s   &f @@@r   setup_import_issue_tests&TestDiscovery.setup_import_issue_tests  sK    **)
'	( 	 r   c                d  a V P                  \        \        R \        P                  4       V P                  \        \        P                  R\        P                  P
                  4       V P                  \        \        P                  R\        P                  P                  4       V P                  \        P                  P                  \        R4      \        \        P                  4      4       V3R lpV\        n        R \        P                  n        R \        P                  n        R# )r9   rB   rJ   Nc                 (   < \        SV ,          4      # r   r  r  s   &r   r  @TestDiscovery.setup_import_issue_package_tests.<locals>.list_dir  r  r   c                 .    V P                  R 4      '       * # r	  r[   r]   s   &r   rV   @TestDiscovery.setup_import_issue_package_tests.<locals>.<lambda>  r  r   c                 $    V P                  R 4      # r	  r[   r]   s   &r   rV   rt    r  r   )rz   rb  r8   r9   rA   rB   rJ   r!  __setitem__slicer}   )r   r  r  s   &f r    setup_import_issue_package_tests.TestDiscovery.setup_import_issue_package_tests  s    Y

;(BGGNNC'277==A,,eDk4>J	#
=:r   c                   \         P                  ! 4       pV P                  R 4       VP                  R4      pV P	                  \
        P                  ! 4       \        P                  4       V P                  VP                  4       ^4       V P                  . VP                  4       V P                  ^\        VP                  4      4       VP                  ^ ,          pV P                  RV9   RV,          4       \        \        V4      ^ ,          4      ^ ,          pV P!                  \"        4      ;_uu_ 4        VP$                  ! 4        RRR4       R#   + '       g   i     R# ; i)test_this_does_not_exist.py.z6Failed to import test module: test_this_does_not_existmissing error string in %rN)r*   r+   rn  r  rA  r8   getcwdr!  rA   r.   countTestCasesassertNotEqualerrorslen
assertTruer}   r/   r@  test_this_does_not_exist)r   r1   r   errortests   &    r   .test_discover_with_modules_that_fail_to_import<TestDiscovery.test_discover_with_modules_that_fail_to_import  s    $$&%%&CD$biik388,--/3B.C./a DM(50	2 DKN#A&{++))+ ,+++s   :EE'	c                  a \        R 4      R.\        R4      RR./pV P                  V4       . oV3R lp\        P                  ! 4       pW#n        VP                  \        R 4      4      pV P                  \        R 4      \        P                  4       V P                  VP                  4       ^4       V P                  . VP                  4       V P                  ^\        VP                  4      4       VP                  ^ ,          pV P                  RV9   RV,          4       \        \        V4      ^ ,          4      ^ ,          pV P!                  \"        4      ;_uu_ 4        VP$                  ! 4        RRR4       V P                  SR.4       \'        \(        P*                  ^,           4       F-  p\(        P,                  ! \(        P.                  ! Wg4      4       K/  	  R#   + '       g   i     Lv; i)	r)   r   r   r   r   c                 <   < SP                  V 4       \        R 4      h)zCannot import Name)r   r@  r2   import_callss   &r   r{   `TestDiscovery.test_discover_with_init_modules_that_fail_to_import.<locals>._get_module_from_name  s    %233r   z(Failed to import test module: my_packager}  N)r   rx  r*   r+   r{   r  rA  r!  rA   r.   r  r  r  r  r  r}   r/   r@  r   rangepickleHIGHEST_PROTOCOLloadsdumps)	r   r  r{   r1   r   r  r  protor  s	   &       @r   3test_discover_with_init_modules_that_fail_to_importATestDiscovery.test_discover_with_init_modules_that_fail_to_import  sr   v()M;K+LN--c2	4 $$&'<$0gfosxx0--/3B.C./a 6%?(50	2 DKN#A&{++OO ,~6 622Q67ELLd23 8 ,+s   #G##G3	c                j   \         P                  P                  '       g   \         P                  ! R 4      h\         P                  ! 4       pR pW!n        V P                  R4       VP                  R4      pV P                  VP                  4       ^4       \         P                  ! 4       pVP                  V4       V P                  \        VP                  4      ^4       \        \        P                   ^,           4       F-  p\        P"                  ! \        P$                  ! W54      4       K/  	  R# )Suite cleanup is disabledc                 .    \         P                  ! R 4      h	skipperoo)r*   SkipTest)r2   s   &r   r{   eTestDiscovery.test_discover_with_module_that_raises_SkipTest_on_import.<locals>._get_module_from_name3  s    ##K00r   ztest_skip_dummy.pyr|  N)r*   BaseTestSuite_cleanupr  r+   r{   rn  r  r.   r  
TestResultrunr  skippedr  r  r  r  r  )r   r1   r{   r   resultr  s   &     r   8test_discover_with_module_that_raises_SkipTest_on_importFTestDiscovery.test_discover_with_module_that_raises_SkipTest_on_import-  s    %%...##$?@@$$&	1'<$%%&:;$--/3$$&		&V^^,a0 622Q67ELLe34 8r   c                n  a \         P                  P                  '       g   \         P                  ! R 4      h\	        R4      R.\	        R4      RR./pV P                  V4       . oV3R lp\         P                  ! 4       pW#n        VP                  \	        R4      4      pV P                  \	        R4      \        P                  4       V P                  VP                  4       ^4       \         P                  ! 4       pVP                  V4       V P                  \!        VP"                  4      ^4       V P                  VP$                  ^4       V P                  SR.4       \'        \(        P*                  ^,           4       F-  p\(        P,                  ! \(        P.                  ! WF4      4       K/  	  R# )r  r)   r   r   r   r   c                 R   < SP                  V 4       \        P                  ! R 4      hr  )r   r*   r  r  s   &r   r{   jTestDiscovery.test_discover_with_init_module_that_raises_SkipTest_on_import.<locals>._get_module_from_nameL  s"    %##K00r   N)r*   r  r  r  r   rx  r+   r{   r  rA  r!  rA   r.   r  r  r  r  r  testsRunr  r  r  r  r  )r   r  r{   r1   r   r  r  r  s   &      @r   =test_discover_with_init_module_that_raises_SkipTest_on_importKTestDiscovery.test_discover_with_init_module_that_raises_SkipTest_on_importD  sD   %%...##$?@@v()M;K+LN--c2	1 $$&'<$0gfosxx0--/3$$&		&V^^,a0!,~6 622Q67ELLe34 8r   c                    \        4       p. pVP                  Vn        VP                  R R.4       V P	                  V. .4       . VR&   VP                  . RO4       V P	                  VRR..4       R# )	somethingr  r*  foobarN)r  r  r  r  )r
   r   _do_discovery	parseArgsr.   r   programargss   &  r   $test_command_line_handling_parseArgs2TestDiscovery.test_command_line_handling_parseArgs_  so    %' $;
34t$QAB/0r   c                j   \        4       p. pVP                  Vn        VP                  R .4       V P	                  V. .4       V P	                  VP
                  ^4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       R# )r  FN
r
   r   r  r  r.   r   assertIsr   r   r   r  s   &  r   .test_command_line_handling_discover_by_default<TestDiscovery.test_command_line_handling_discover_by_defaultk  s    %' $;-(t$**A.gnne,g((%0g&&.r   c                l   \        4       p. pVP                  Vn        VP                  . RO4       V P	                  V. .4       V P	                  VP
                  ^4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       R# )r  TN)r  -vz-br  -c-fr  r  s   &  r   ;test_command_line_handling_discover_by_default_with_optionsITestDiscovery.test_command_line_handling_discover_by_default_with_optionsw  s    %' $EFt$**A.gnnd+g(($/g&&-r   c           	        \        4       pR Vn        \        P                  ! 4       ;_uu_ 4       pV P	                  \
        4      ;_uu_ 4       pVP                  . RO4       R R R 4       R R R 4       V P                  XP                  P                  R4       V P                  RXP                  4       4       R #   + '       g   i     L`; i  + '       g   i     Lk; i)Nzusage:)onetwothreefour)   )r
   r!   r   captured_stderrr/   
SystemExitr  r.   	exceptionr  rA  getvalue)r   r  stderrcms   &   r   :test_command_line_handling_do_discovery_too_many_argumentsHTestDiscovery.test_command_line_handling_do_discovery_too_many_arguments  s    %'!$$&&&z**b!!"AB + ' 	**D1h 12	 +* '&s#   CB9	!C9C	CC	c                    \         P                  \        P                  4      pVP	                  4         ! R  R\         4      pV! 4       Vn        VP                  R.4       V P                  VP                  R.4       R# )c                   *   a  ] tR tRt o . tR tRtV tR# )YTestDiscovery.test_command_line_handling_do_discovery_uses_default_loader.<locals>.Loaderi  c                @    V P                   P                  WV34       R # r9  r  r   r   r  rh   r2  s   &&&&r   r  bTestDiscovery.test_command_line_handling_do_discovery_uses_default_loader.<locals>.Loader.discover      		  )m!DEr   r   Nr   r   r   r   r  r  r"   r#   r$   s   @r   Loaderr         D r   r  r  Nr|  rs   N)	r   __new__r*   TestProgram_initArgParsersr!   r  r.   r  r   r  r  s   &  r   ;test_command_line_handling_do_discovery_uses_default_loaderITestDiscovery.test_command_line_handling_do_discovery_uses_default_loader  sb    ..!5!56!	V 	 $Xtf%'>&?@r   c                   \        4       p ! R  R\        4      pVP                  R.VR7       V P                  VP                  ^4       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  R.VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  . VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  R.VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  RR.VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  . ROVR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  R	R.VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  R
R.VR7       V P                  VP
                  R4       V P                  VP                  R.4       . Vn        \        4       pVP                  RR.VR7       V P                  VP
                  R4       V P                  VP                  R.4       V P                  VP                  4       V P                  VP                  4       . Vn        \        4       pVP                  . ROVR7       V P                  VP
                  R4       V P                  VP                  R.4       V P                  VP                  ^4       V P                  VP                  4       V P                  VP                  4       R# )c                   *   a  ] tR tRt o . tR tRtV tR# )RTestDiscovery.test_command_line_handling_do_discovery_calls_loader.<locals>.Loaderi  c                @    V P                   P                  WV34       R # r9  r  r  s   &&&&r   r  [TestDiscovery.test_command_line_handling_do_discovery_calls_loader.<locals>.Loader.discover  r  r   r   Nr  r$   s   @r   r  r    r  r   r  r  )r  r   Nz	--verbosefisheggs-sz-t-pr  )r  rs   N)r  r  N)r  r  ham)r|  rs   r  )r|  r  N)r  r  r  r  r  r  r  )r
   r   r  r.   r   r  r  assertFalser   r   r  r  s   &  r   4test_command_line_handling_do_discovery_calls_loaderBTestDiscovery.test_command_line_handling_do_discovery_calls_loader  s   %'	V 	 	tfV4**A.w/'>&?@%'{mF;w/'>&?@%'b0w/'>&?@%'vhv6w/'A&BC%'vv.v>w/'=&>?%'5fEw/'>&?@%'tVnV<w/'A&BC%'tVnV<w/'@&AB%'tVnV<w/':&;<))*++,%'L%+ 	 	-w/'=&>?**A.(()**+r   c                  aaaa	a
  ! R  R\         4      pV\        P                  R&   \        P                  P                  R4      o\        P                  o	\        P                  P                  o\        P                  P                  o\        P                  P                  o
VVVV	V
3R lpV P                  V4       R pR pR pV\        n        V\        P                  n        V\        P                  n        \        P                  R8X  d.   \        P                  P
                  \        P                  n	        S# )c                       ] tR tRtRtRtR# )0TestDiscovery.setup_module_clash.<locals>.Modulei  z
bar/foo.pyr   N)r   r   r   r   r  r"   r   r   r   r   r    s    #Hr   r   r  c                  *  < S\         n        S\         P                  n        S\         P                  n        S\         P                  n        \        P                  R  S \        P                  9   d"   \        P                  P                  S 4       R# R# )r  N)	r8   r9   rA   rB   rJ   realpathr!  modulesr"  )rC  rL   rD   r;   original_realpaths   r   cleanup1TestDiscovery.setup_module_clash.<locals>.cleanup  sY    )BJ,BGGN*BGGM0BGGE"CHH$	* %r   c                     R .# foo.pyr   rk  s   &r   r9   1TestDiscovery.setup_module_clash.<locals>.listdir  s
    :r   c                     R # r   r   rk  s   &r   rB   0TestDiscovery.setup_module_clash.<locals>.isfile      r   c                     R # r   r   rk  s   &r   rJ   /TestDiscovery.setup_module_clash.<locals>.isdir   r  r   nt)r   r!  r  r8   rA   r   r9   rB   rJ   r  rz   r2   )r   r   r  r9   rB   rJ   rC  rL   rD   r;   r  s   &     @@@@@r   setup_module_clash TestDiscovery.setup_module_clash  s    	$V 	$#EGGOOE*	::''..GG,,	+ 	+ 	 			
77d?  "wwBGGr   c                   V P                  4       p\        P                  ! 4       p\        P                  P                  R 4      p\        P                  P                  R4      p\        P                  ! RV: RV: R24      pV P                  \        RV,          VP                  RRR7       V P                  \        P                  ^ ,          V4       R# )	r  r  z''foo' module incorrectly imported from z. Expected z$. Is this module globally installed?z^%s$r  r  N)r  r*   r+   r8   rA   r   reescapeassertRaisesRegexr@  r  r.   r!  )r   rC  r1   mod_direxpected_dirmsgs   &     r   test_detect_module_clash&TestDiscovery.test_detect_module_clash  s    ++-	$$&''//%(wwu-ii8?O P#vX 	 	
 	!i0r   c                  aaa V P                  4       p\        P                  P                  o\        P                  P	                  R 4      o\        P                  P	                  R4      oV3R lpV P                  V4       VV3R lpV\        P                  n        \        P                  ! 4       pVP                  RRR7       R# )r  r  c                  2   < S \         P                  n        R # r   )r8   rA   r  )r  s   r   r  5TestDiscovery.test_module_symlink_ok.<locals>.cleanup!  s    0BGGr   c                    < V \         P                  P                  SR 4      8X  d!   \         P                  P                  SR 4      # V # r  )r8   rA   join)rA   r  r  s   &r   r  6TestDiscovery.test_module_symlink_ok.<locals>.realpath%  s4    rww||GX66ww||L(;;Kr   r  r  N)	r  r8   rA   r  r   rz   r*   r+   r  )r   rC  r  r  r1   r  r  r  s   &    @@@r   test_module_symlink_ok$TestDiscovery.test_module_symlink_ok  s    ++-	GG,,''//%(wwu-	1 	 $$$&%:r   c                  a aa \         P                  ! 4       pS .o\        P                  P	                  \        P                  P                  \        P                  P                  4      4      oR S n	        RVV V3R llpW!n
        VP                  R4      pS P                  S P                  4       S P                  VP                  S4       R# )FNc                 :   < R Sn         SP                  V S4       S# r   )wasRunr.   )r  rh   r<  expectedPathr   r   s   &&&r   r~   BTestDiscovery.test_discovery_from_dotted_path.<locals>._find_tests4  s    DKY5Lr   ztest.test_unittestr   )r*   r+   r8   rA   r   r  r  test_unittestr  r  r~   r  r  r.   _tests)r   r1   r~   r   r  r   s   f   @@r   test_discovery_from_dotted_path-TestDiscovery.test_discovery_from_dotted_path-  s    $$&wwrwwt7I7I7R7R'ST	 	 ) 45$u-r   c                D  aaaa \         P                  ! 4       p\        P                  oR  \        n        \        P                  P
                  o\        P                  P                  oR \        P                  n        \        P                  R,          oVVVV3R lpV P                  V4       V P                  \        4      ;_uu_ 4       pVP                  R4       RRR4       V P                  \        XP                  4      R4       R#   + '       g   i     L7; i)c                     R .# )r{  r   rk  s   &r   rV   OTestDiscovery.test_discovery_from_dotted_path_builtin_modules.<locals>.<lambda>C  s     =>r   c                     R # r   r   rk  s   &r   rV   r  F  s    %r   r*  c                     < S\         P                  n        S \         P                  n        S\         n        S\
        P                  R &   R# r,  )r8   rA   rB   rJ   r9   r!  )rJ   rB   r9   r-  s   r   rI  NTestDiscovery.test_discovery_from_dotted_path_builtin_modules.<locals>.restoreH  s-    #BGGN!BGGM BJ'CHHQKr   r!  Nz2Can not use builtin modules as dotted module names)r*   r+   r8   r9   rA   rB   rJ   r!  rz   r/   	TypeErrorr  r.   rB  r  )r   r1   rI  r  rJ   rB   r9   r-  s   &   @@@@r   /test_discovery_from_dotted_path_builtin_modules=TestDiscovery.test_discovery_from_dotted_path_builtin_modules>  s    $$&**>
'	( 	(
 	 y))ROOE" *R\\*2	3 *)s   DD	c                  aa \         P                  ! 4       p\        P                  ! R 4      oRSn        RR.Sn        RSn        \        P                  ! SP                  \        SP                  SP
                  R4      RR.R7      Sn	        V3R lp. oRV3R llpW1n
        \        Vn        \         P                  P                  RV4      ;_uu_ 4        \        P                   ! 4       ;_uu_ 4        \"        P$                  ! R 4      ;_uu_ 4        VP'                  R 4      pRRR4       RRR4       RRR4       V P)                  XR	R
.4       R#   + '       g   i     L6; i  + '       g   i     LA; i  + '       g   i     LL; i)packager   z/az/bN)r2   r1   submodule_search_locationsc                 .   < S\         P                  V &   S# r   r!  r  packagenamer  kwargsr'  s   &*,r   _importLTestDiscovery.test_discovery_from_dotted_namespace_packages.<locals>._importb      '.CKK$Nr   c                 <   < SP                  W34       R V ,          .# )z%s/testsr:  r;  s   &&&r   r~   PTestDiscovery.test_discovery_from_dotted_namespace_packages.<locals>._find_testsg  s"    ##Y$89*++r   builtins.__import__z/a/testsz/b/testsr   )r*   r+   types
ModuleTyper   __path__r  SimpleNamespacer   __spec__r~   r}   r|   mockpatchr   DirsOnSysPath	test_utiluncacher  r.   )r   r1   r.  r~   r   r=  r'  s   &    @@r   -test_discovery_from_dotted_namespace_packages;TestDiscovery.test_discovery_from_dotted_namespace_packagesU  s#   $$&""9-" $< 00!!"7#3#3W5E5EtL(,d|
	 	, ) ]]  !6@@,,..&&y11"OOI6E 2 / A 	Z 89 21 /. A@s<   E:5E'	E&E'	.E:E$E'	'E72E::F
	c           	        \         P                  ! 4       p\        P                  ! \        P
                  P                  \        P
                  P                  \        4      4      4      ;_uu_ 4        \        P                  ! R4      ;_uu_ 4        VP                  R4      pRRR4       RRR4       T P                  XP                   Uu0 uFC  p\        V4      '       g   K  \        V4      ^ ,          P                  ^ ,          P                  kKE  	  upRR04       R#   + '       g   i     L; i  + '       g   i     L; iu upi )zDSubdirectory discovery not affected if start_dir is a namespace pkg.namespace_test_pkgNznamespace_test_pkg.test_fooznamespace_test_pkg.bar.test_bar)r*   r+   r   r;  r8   rA   r  r  r  r<  r=  r  r.   r  r}   r   )r   r1   r   s   &  r   %test_discovery_start_dir_is_namespace3TestDiscovery.test_discovery_start_dir_is_namespacew  s    $$&''RWW__X5N(OPP233OO$89E 4 Q 	>CllZlUdSXk0T%[^""1%00lZ*,MN	
 43 QP
 [s0   2D4D!	#D4E$1E!D1,D44E	c                  a ^ RI Hp \        P                  ! 4       p\        P
                  ! R4      oV3R lp\        P                  P                  RV4      ;_uu_ 4        \        P                  ! 4       ;_uu_ 4        VP                  R4      ;_uu_ 4        V P                  \        4      ;_uu_ 4       pVP                  R4       RRR4       V P                  \        XP                   4      RP#                  S4      4       RRR4       RRR4       RRR4       R#   + '       g   i     L^; i  + '       g   i     L5; i  + '       g   i     L@; i  + '       g   i     R# ; i)r   r   r'  c                 .   < S\         P                  V &   S# r   r*  r+  s   &*,r   r.  >TestDiscovery.test_discovery_failed_discovery.<locals>._import  r0  r   r3  Nz$don't know how to discover from {!r})test.test_importlibr   r*   r+   r4  r5  r9  r:  r   r;  r=  r/   r#  r  r.   rB  r  format)r   r   r1   r.  r  r'  s   &    @r   test_discovery_failed_discovery-TestDiscovery.test_discovery_failed_discovery  s    ,$$&""9-	 ]]  !6@@,,..\\),,**955	2 6$$S%6%L&,fWo7 - / A@
 65 -, /. A@@sT   !E?E	D27D	<D2E	ED/*D22E=E	EEE)	)r  N)#r   r   r   r   r3   r   r   r   r   r#  rD  rO  rc  rn  rx  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r$  r>  rB  rI  r"   r#   r$   s   @r   r'   r'      s     61*f&$PH2TE5NV5p,/\60+;Z
!	;,(4<5.56
1
/
.	3AH,T!F1;(."3. :D
7 7r   r'   __main__)os.pathr8   r   r  r!  r4  r  importlib._bootstrap_externalr   r  r   test.supportr   r*   unittest.mocktest.test_unittestrG  r   r<  r  r
   TestCaser'   r   mainr   r   r   <module>rS     sk      	 
   9  &    1	(.. 	{7H%% {7| zMMO r   