+
    VBiV                         ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHtH	t	 ^RI
Ht ^RIHt ^RIHtHtHt ] P$                  P&                  tR t]! R	]	! ]R
7      R7       ! R R]4      4       tR# )    N)StringIO)TestCase)patchMock)Options)parse_command_line)backup_Optionsrestore_Optionscheck_global_optionsc           
          V R \         P                  P                  RR 4      \         P                  P                  RR 4      RRRRRR3	9   d   R	# \        V 4      # )

source.pyx	/work/dirmy_working_pathfile.pyx	file1.pyx	file2.pyx	file3.pyxfoo.pyxbar.pyxT)ospathjoinunpatched_exists)r   s   &F/usr/lib/python3.14/site-packages/Cython/Compiler/Tests/TestCmdLine.pypatched_existsr      sY    
[,/
&5
 
 D!!    zos.path.exists)side_effect)newc                   |  a  ] tR t^t o R tR t. 3R lt. 3R l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$R" t%R# t&R$ t'R% t(R& t)R' t*R( t+R) t,R* t-R+ t.R, t/R- t0R. t1R/ t2R0 t3R1 t4R2 t5R3 t6R4 t7R5 t8R6 t9R7 t:R8 t;R9t<V t=R:# );CmdLineParserTestc                $    \        4       V n        R # N)r	   _options_backupselfs   &r   setUpCmdLineParserTest.setUp!   s    -/r   c                0    \        V P                  4       R # r"   )r
   r#   r$   s   &r   tearDownCmdLineParserTest.tearDown$   s    ,,-r   c                R    V P                  \        V P                  V4      R 4       R# ) N)assertEqualr   r#   )r%   
white_lists   &&r   check_default_global_options.CmdLineParserTest.check_default_global_options'   s!    -d.B.BJOQSTr   c                   \         P                  ! \         P                  4      p\        4       pVP                  P                  4        F9  pWR9  g   K  V P                  \        WV4      \        W54      R V,           R7       K;  	  R# )zerror in option )msgN)r   CompilationOptionsdefault_optionsobject__dict__keysr-   getattr)r%   optionsr.   r4   no_valuenames   &&&   r   check_default_options'CmdLineParserTest.check_default_options*   sq    !44W5L5LM8#,,113D%  !A7?Cagy  }A  hA   B 4r   c                4   \        . RO4      w  rV P                  V4       V P                  VP                  4       V P                  VP                  4       V P                  VP
                  4       V P                  VP                  4       V P                  VP                  ^8  4       V P                  \        P                  4       V P                  \        P                  4       V P                  \        P                  4       V P                  VP                  ^4       \        . RO4      w  rV P                  V4       V P                  \        V4      ^8H  4       V P                  VP                  4       V P                  VP                  ^4       R# )-VN)r?   z-lz-+z-t-vr@   r@   z-pz-D-az-3)z-fz-2r   )r   assertFalse
assertTrueshow_versionuse_listing_filecplus
timestampsverboser   embed_pos_in_docstring
docstringsannotater-   language_levellenr%   r9   sourcess   &  r   test_short_options$CmdLineParserTest.test_short_options1   s,   - /
  	!,,-001&**+1,-667++,(()//3- /
  	 G)*++,//3r   c                   \        . RO4      w  rV P                  V4       V P                  VP                  4       V P                  VP                  4       V P                  VP
                  4       V P                  \        P                  R4       V P                  VP                  4       V P                  VP                  ^8  4       V P                  \        P                  4       V P                  \        P                  4       V P                  \        P                  4       V P                  \        P                  4       V P                  \        P                  4       \        RR.4      w  rV P                  V4       V P                  \!        V4      ^8H  4       V P                  VP                  4       R# )	--versionmainz--forcer   N)rS   z--create-listingz--cplus--embed--timestamps	--verboserW   rW   z--embed-positionsz--no-docstrings
--annotatez	--lenient)r   rB   rC   rD   rE   rF   r-   r   embedrG   rH   rI   rJ   rK   error_on_unknown_nameserror_on_uninitializedrM   rN   s   &  r   test_long_options#CmdLineParserTest.test_long_optionsH   sA   - /
 
 	!,,-001&/**+1,-667++,(()778778-|/
  	 G)*++,r   c                    \        . RO4      w  rV P                  VR.4       V P                  \        P                  R4       V P                  VP                  . RO4       V P                  VP
                  R4       V P                  VP                  R4       V P                  \        P                  R4       V P                  \        P                  ^4       V P                  \        P                  4       V P                  \        P                  R4       V P                  VP                  4       V P                  VP                  R4       V P                  VP                  R,          R	4       V P                  VP                  R
4       R# )--embed=huhur   huhur   z/output/dirz/pre/importzcov.xmlz/gdb/outdir
wraparoundFz
foo.sharedN)r_   z-I/test/include/dir1z --include-dir=/test/include/dir2z--include-dir/test/include/dir3z--working=/work/dirr   z--output-file=/output/dirz--pre-import=/pre/importz--cleanup=3z--annotate-coverage=cov.xmlz--gdb-outdir=/gdb/outdirz--directive=wraparound=falsez--shared=foo.shared)z/test/include/dir1z/test/include/dir2rb   )r   r-   r   rY   include_pathworking_pathoutput_file
pre_importgenerate_cleanup_coderC   rK   annotate_coverage_xml	gdb_debug
output_dircompiler_directivesshared_utility_qualified_namerN   s   &  r   test_options_with_values*CmdLineParserTest.test_options_with_valuesb   s,   - /
  	<.1/--/qr--{;,,m<++];66:(()66	B))*++];44\BEJ>>Mr   c                    \        R R.4      w  rV P                  VR.4       V P                  \        P                  R4       R# )rU   r   rT   Nr   r-   r   rY   rN   s   &  r   test_embed_before_positional.CmdLineParserTest.test_embed_before_positional   sB    -/
  	<.1/r   c                    \        . RO4      w  rV P                  VR.4       V P                  \        P                  R4       R# )rU   r   r`   N)rU   r_   r   rp   rN   s   &  r   test_two_embeds!CmdLineParserTest.test_two_embeds   <    - /
  	<.1/r   c                    \        . RO4      w  rV P                  VR.4       V P                  \        P                  R4       R# )r_   r   rT   N)r_   rU   r   rp   rN   s   &  r   test_two_embeds2"CmdLineParserTest.test_two_embeds2   rv   r   c                b    \        R R.4      w  rV P                  \        P                  4       R# )r_   r   N)r   rB   r   rK   rN   s   &  r   test_no_annotate"CmdLineParserTest.test_no_annotate   s/    -L/
  	))*r   c                d    \        R R.4      w  rV P                  \        P                  R4       R# )rA   r   defaultNr   r-   r   rK   rN   s   &  r   test_annotate_short%CmdLineParserTest.test_annotate_short   s2    -/
  	))95r   c                d    \        R R.4      w  rV P                  \        P                  R4       R# )rX   r   r~   Nr   rN   s   &  r   test_annotate_long$CmdLineParserTest.test_annotate_long   s2    -/
  	))95r   c                d    \        R R.4      w  rV P                  \        P                  R4       R# )--annotate-fullcr   fullcNr   rN   s   &  r   test_annotate_fullc%CmdLineParserTest.test_annotate_fullc   s2    -/
  	))73r   c                    \        . RO4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )-wr   rd   N)r   r   r   )r   r-   rd   r/   r<   rN   s   &  r   test_short_wCmdLineParserTest.test_short_w   sL    - /
  	--/@A))+""7^,<=r   c                    \        . RO4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )-o	my_outputre   N)r   r   r   )r   r-   re   r/   r<   rN   s   &  r   test_short_oCmdLineParserTest.test_short_o   sJ    - /
  	,,k:))+""7]O<r   c                    \        . RO4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )-zmy_preimportrf   N)r   r   r   )r   r-   r   rf   r/   r<   rN   s   &  r   test_short_zCmdLineParserTest.test_short_z   sJ    - /
  	++^<))<.9""7+r   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z--convert-ranger   Tconvert_rangeN)r   r-   r   r   r/   r<   rN   s   &  r   test_convert_range$CmdLineParserTest.test_convert_range   sQ    -/
  	..5))?*;<""7+r   c                    \        R R.4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )z--line-directivesr   Temit_linenumsN)r   r-   r   r/   r<   rN   s   &  r   test_line_directives&CmdLineParserTest.test_line_directives   sQ    -/
  	..5))+""7_,=>r   c                    \        R R.4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )z--no-c-in-tracebackr   Fc_line_in_tracebackN)r   r-   r   r/   r<   rN   s   &  r   test_no_c_in_traceback(CmdLineParserTest.test_no_c_in_traceback   sR    -!/
  	44e<))+""7-B,CDr   c                    \        R R.4      w  rV P                  VP                  R4       V P                  VP                  \        P
                  4       V P                  4        V P                  VRR.4       R# )--gdbr   Tri   rj   Nr   r-   ri   rj   r   curdirr/   r<   rN   s   &  r   test_gdbCmdLineParserTest.test_gdb   sm    -/
  	**D1++RYY7))+""7[,,GHr   c                    \        R R.4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )z--3strr   3rL   N)r   r-   rL   r/   r<   rN   s   &  r   	test_3strCmdLineParserTest.test_3str   sR    -/
  	//5))+""7-=,>?r   c                    \        R R.4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )z--capi-reexport-cincludesr   Tcapi_reexport_cincludesN)r   r-   r   r/   r<   rN   s   &  r   test_capi_reexport_cincludes.CmdLineParserTest.test_capi_reexport_cincludes   sR    -'/
  	88$?))+""7-F,GHr   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z--fast-failr   T	fast_failN)r   r-   r   r   r/   r<   rN   s   &  r   test_fast_fail CmdLineParserTest.test_fast_fail  sP    -/
  	**D1));-8""7+r   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z--cimport-from-pyxr   Tcimport_from_pyxN)r   r-   r   r   r/   r<   rN   s   &  r   test_cimport_from_pyx'CmdLineParserTest.test_cimport_from_pyx  sR    - /
  	1148))+=*>?""7+r   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z-Werrorr   Twarning_errorsNr   r-   r   r   r/   r<   rN   s   &  r   test_WerrorCmdLineParserTest.test_Werror  sR    -/
  	//6))+;*<=""7+r   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z--warning-errorsr   Tr   Nr   rN   s   &  r   test_warning_errors%CmdLineParserTest.test_warning_errors  sR    -/
  	//6))+;*<=""7+r   c                    \        R R.4      w  rV P                  VP                  \        P                  4       V P                  4        V P                  VR.4       R# )z-Wextrar   rk   Nr   r-   rk   r   extra_warningsr/   r<   rN   s   &  r   test_WextraCmdLineParserTest.test_Wextra(  sX    -/
  	44g6L6LM))+""7-B,CDr   c                    \        R R.4      w  rV P                  VP                  \        P                  4       V P                  4        V P                  VR.4       R# )--warning-extrar   rk   Nr   rN   s   &  r   test_warning_extra$CmdLineParserTest.test_warning_extra1  sX    -/
  	44g6L6LM))+""7-B,CDr   c                    \        R R.4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )z--old-style-globalsr   Told_style_globalsN)r   r-   r   r   r/   r<   rN   s   &  r   test_old_style_globals(CmdLineParserTest.test_old_style_globals:  sR    -!/
  	22D9))+>*?@""7+r   c                    \        . RO4      w  rV P                  VP                  R,          R4       V P                  VP                  R,          R4       V P                  4        V P	                  VR.4       R# )-X	cdivisionTc_string_typebytesrk   N)r   cdivision=Truer   c_string_type=bytesr   r   r-   rk   r/   r<   r%   r9   sources   &  r   test_directive_multiple)CmdLineParserTest.test_directive_multipleC  sk    , .
 
 	44[A4H44_EwO))+""7-B,CDr   c                    \        . RO4      w  rV P                  VP                  R,          R4       V P                  VP                  R,          R4       V P                  4        V P	                  VR.4       R# )r   r   Tr   r   rk   N)r   z"cdivision=True,c_string_type=bytesr   r   r   s   &  r   test_directive_multiple_v2,CmdLineParserTest.test_directive_multiple_v2N  sk    , .
  	44[A4H44_EwO))+""7-B,CDr   c                    \        . RO4      w  rV P                  VP                  R,          R4       V P                  4        V P	                  VR.4       R# )r   r   Trk   N)r   zcdivision=YeSr   r   r   s   &  r   test_directive_value_yes*CmdLineParserTest.test_directive_value_yesX  sP    , .
  	44[A4H))+""7-B,CDr   c                    \        . RO4      w  rV P                  VP                  R,          R4       V P                  4        V P	                  VR.4       R# )r   r   Frk   N)r   zcdivision=nor   r   r   s   &  r   test_directive_value_no)CmdLineParserTest.test_directive_value_noa  sP    , .
  	44[A5I))+""7-B,CDr   c                @    V P                  \        \        . RO4       R# )r   N)r   zcdivision=sadfasdr   assertRaises
ValueErrorr   r$   s   &r   test_directive_value_invalid.CmdLineParserTest.test_directive_value_invalidj      *&8 ;
 	r   c                @    V P                  \        \        . RO4       R# )r   N)r   abracadabrar   r   r$   s   &r   test_directive_key_invalid,CmdLineParserTest.test_directive_key_invalidp  r   r   c                @    V P                  \        \        . RO4       R# )r   N)r   r   r   r   r$   s   &r   test_directive_no_value)CmdLineParserTest.test_directive_no_valuev  r   r   c                    \        . RO4      w  rV P                  VP                  R,          ^
4       V P                  4        V P	                  VR.4       R# )-EMYSIZEcompile_time_envN)r   	MYSIZE=10r   r   r-   r   r/   r<   r   s   &  r   test_compile_time_env_short-CmdLineParserTest.test_compile_time_env_short|  P    , .
  	11(;R@))+""7-?,@Ar   c                    \        . RO4      w  rV P                  VP                  R,          ^
4       V P                  4        V P	                  VR.4       R# )--compile-time-envr   r   N)r   r   r   r   r   s   &  r   test_compile_time_env_long,CmdLineParserTest.test_compile_time_env_long  r   r   c                    \        . RO4      w  rV P                  VP                  R,          ^
4       V P                  VP                  R,          ^4       V P                  4        V P	                  VR.4       R# )r   r   ARRSIZEr   N)r   r   r   z
ARRSIZE=11r   r   r   s   &  r   test_compile_time_env_multiple0CmdLineParserTest.test_compile_time_env_multiple  k    , .
  	11(;R@11)<bA))+""7-?,@Ar   c                    \        . RO4      w  rV P                  VP                  R,          ^
4       V P                  VP                  R,          ^4       V P                  4        V P	                  VR.4       R# )r   r   r   r   N)r   zMYSIZE=10,ARRSIZE=11r   r   r   s   &  r   !test_compile_time_env_multiple_v23CmdLineParserTest.test_compile_time_env_multiple_v2  r  r   c                J    \        R R.4      w  rV P                  VR.4       R# )r?   r   Nr   r-   rN   s   &  r   test_option_first#CmdLineParserTest.test_option_first  s&    -tZ.@A:,/r   c                J    \        . RO4      w  rV P                  VR.4       R# )r?   r   N)r?   r   rA   r  rN   s   &  r   test_file_inbetween%CmdLineParserTest.test_file_inbetween  s"    -.FG:,/r   c                J    \        R R.4      w  rV P                  VR .4       R# )r   r?   Nr  rN   s   &  r   test_option_trailing&CmdLineParserTest.test_option_trailing  s&    -z4.@A:,/r   c                L    \        . RO4      w  rV P                  V. RO4       R# )r   N)r   r?   r   rA   r   )r   r   r   r  rN   s   &  r   test_multiple_files%CmdLineParserTest.test_multiple_files  s'    - /
 
 	"IJr   c                    \        . RO4      w  r^ RIHp R F-  pV P                  \	        W44      VR9   4       \        W4^ 4       K/  	  R# )--debug-disposal-code)
DebugFlagsN)r  z--debug-coercionr   )debug_disposal_codedebug_temp_allocdebug_coercion)r  r  )r   Cython.Compilerr  r-   r8   setattr)r%   r9   rO   r  r;   s   &    r   test_debug_flags"CmdLineParserTest.test_debug_flags  sI    - /
  	/QDWZ6@i8ijJa( Rr   c                    \        . RO4      w  rV P                  VP                  R4       V P                  VP                  \        P
                  4       V P                  4        V P                  VRR.4       R# )--gdb-outdir=my_dirTri   rj   N)r  r   r   r   rN   s   &  r   test_gdb_overwrites_gdb_outdir0CmdLineParserTest.test_gdb_overwrites_gdb_outdir  sg    - /
  	**D1++RYY7))+""7[,,GHr   c                    \        . RO4      w  rV P                  VP                  R4       V P                  VP                  R4       V P	                  4        V P                  VRR.4       R# )r   Tmy_dirri   rj   N)r   r  r   )r   r-   ri   rj   r/   r<   rN   s   &  r   test_gdb_first CmdLineParserTest.test_gdb_first  sc    - /
  	**D1++X6))+""7[,,GHr   c                    \        . RO4      w  rV P                  \        P                  R4       V P                  \        P                  R4       V P                  RR.4       V P                  V4       R# )r   Tmy.xmlrK   rh   N)r   --annotate-coverage=my.xmlr   r   r-   r   rK   rh   r/   r<   rN   s   &  r   #test_coverage_overwrites_annotation5CmdLineParserTest.test_coverage_overwrites_annotation  sd    - /
  	))4066A)):7N*OP""7+r   c                    \        . RO4      w  rV P                  \        P                  R4       V P                  \        P                  R4       V P                  RR.4       V P                  V4       R# )r(  r   r'  rK   rh   N)r(  r   r   r)  rN   s   &  r   test_coverage_first%CmdLineParserTest.test_coverage_first  sd    - /
  	))7366A)):7N*OP""7+r   c                    \        . RO4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )rX   r   rK   N)rX   r   r   r   r-   r   rK   r/   r<   rN   s   &  r    test_annotate_first_fullc_second2CmdLineParserTest.test_annotate_first_fullc_second  sJ    - /
  	))73)):,7""7+r   c                    \        . RO4      w  rV P                  \        P                  R4       V P	                  R.4       V P                  V4       R# )r   r~   rK   N)r   rX   r   r0  rN   s   &  r   test_annotate_fullc_first+CmdLineParserTest.test_annotate_fullc_first  sJ    - /
  	))95)):,7""7+r   c                    \        . RO4      w  rV P                  \        VP                  4      \        \        P
                  4      ^,           4       V P                  4        V P                  VR.4       R# )r   rk   N)r   r   r   r   r   r   )r   rC   rM   rk   r   r   r/   r<   rN   s   &  r   !test_warning_extra_dont_overwrite3CmdLineParserTest.test_warning_extra_dont_overwrite  s`    - /
  	G778#g>T>T:UXY:YZ))+""7-B,CDr   c                8   \        R .4      w  rV P                  VP                  R4       V P                  4        V P	                  V4       \        . RO4      w  rV P                  VP                  R4       V P                  4        V P	                  VR.4       R# )r   Nfoo.barmodule_name)--module-namer:  r   )r   r-   r;  r/   r<   rN   s   &  r   test_module_name"CmdLineParserTest.test_module_name  s    -/
  	,,d3))+""7+- /
  	,,i8))+""7]O<r   c                ~    \        R .4      w  rV P                  V. 4       V P                  VP                  R4       R# )z--generate-shared=foo/shared.czfoo/shared.cN)r   r-   shared_c_file_pathrN   s   &  r   test_generate_shared&CmdLineParserTest.test_generate_shared  s?    -,/
  	"%33^Dr   c                <  a  RV 3R llpV! R.R4       V! R.R4       V! R.R4       V! R.R	4       V! R
.R4       V! R.R4       V! R.R4       V! RR.R4       V! RR.R4       V! RR.R4       V! . ROR4       V! . ROR4       V! RR.R4       V! R.R4       R # ) Nc                 (  < \         P                  p\        4       ;p\         n         SP                  \        \
        \        V 4      4       V\         n        VP                  4       pR P                  VP                  4       4      pSP                  VP                  R4      RV,          4       SP                  RV9   RV,          4       V'       d1   SP                  \        P                  ! W4      V: RV: R24       R# R#   T\         n        i ; i)zMessage "{}"zusage: z %s does not start with "usage :"z	: error: z%s does not contain ": error :"z does not match search ""N)sysstderrr   r   
SystemExitr   listgetvalueformatstriprC   
startswithresearch)argsregex
old_stderrrG  r2   err_msgr%   s   &&    r   error,CmdLineParserTest.test_errors.<locals>.error  s    J"**,FSZ(!!*.@$t*M'
//#C$++CIIK8GOOCNN95>HJOOK3.=GI		% 5!(%!12  (
s   $D Dz-1zunknown option -1z-Iz0argument -I/--include-dir: expected one argumentz--version=-az5argument -V/--version: ignored explicit argument '-a'z--version=--annotate=truezBargument -V/--version: ignored explicit argument '--annotate=true'z	--workingz,argument -w/--working: expected one argumentz--verbose=1z4argument -v/--verbose: ignored explicit argument '1'z	--cleanupz)argument --cleanup: expected one argumentz --debug-disposal-code-wrong-namer   z/unknown option --debug-disposal-code-wrong-namer<  r   zNeed at least one source filer:  z5Only one source file allowed when using --module-namez*Cannot use --module-name with --timestampsz--generate-shared=shared.cz4Source file not allowed when using --generate-sharedz--generate-sharedz1argument --generate-shared: expected one argumentr"   )r<  r:  r   r   )r<  r:  rV   r    )r%   rT  s   f r   test_errorsCmdLineParserTest.test_errors  s    	2$ 	tf!	#tf@	B~E	G*+"	# 	{m<	>}oD	F{m9	;1;??	A	*-	/	*-	/@E	GE:	<+Y7D	F"#A	Cr   )r#   N)>__name__
__module____qualname____firstlineno__r&   r)   r/   r<   rP   r\   rm   rq   rt   rx   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r	  r  r  r  r  r   r$  r*  r-  r1  r4  r7  r=  rA  rW  __static_attributes____classdictcell__)__classdict__s   @r   r    r       sD    0. 79 U 9; B4.-4N:000+664>=,,?EI@I,,,,EE,	EEEEBBBB000K)II,,,,	E=E/C /Cr   r    )r   rF  rN  ior   unittestr   unittest.mockr   r   r,   r   CmdLiner   Utilsr	   r
   r   r   existsr   r   r    rV  r   r   <module>rf     sd    	 
 	   %  ( H H77>> "  Tn=>jC jC ?jCr   