
    
3j(                         S r SSKrSSKrSSKrSSKrSSKJr  SSKrSSKrSSK	r	SSK
Jr  SSKrSSKJr  \R                  " \5      rS rS rS r   SS	 jrSS
.S jrS rS rS rS rS rg)z
Helper functions for testing.
    N)Path)TemporaryDirectory)_apic                  P    S[         R                  S'   S[         R                  S'   g )NDejaVu Sanszfont.familydefaultztext.hintingmplrcParams     U/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/testing/__init__.pyset_font_settings_for_testingr      s    "/CLL#,CLL r   c                  *    S[         R                  S'   g )N
matplotlibzsvg.hashsaltr	   r   r   r   set_reproducibility_for_testingr      s    #/CLL r   c                      [         R                  " [         R                  S5        [        R                  " S5        [        R                  " 5          [        R                  " 5         S S S 5        [        5         [        5         g ! [         R                   aY     [         R                  " [         R                  S5         N! [         R                   a    [        R                  S5          Nf = ff = f! , (       d  f       N= f)Nzen_US.UTF-8zEnglish_United States.1252zPCould not set locale to English/United States. Some date-related tests may fail.Agg)locale	setlocaleLC_ALLError_logwarningr
   user   'suppress_matplotlib_deprecation_warning
rcdefaultsr   r   r   r   r   setupr      s    56 GGEN		5	5	7 
8
 "##%! << 5	5V]],HI|| 	5LL45	55 
8	7s5   %B C5C2%C)C.*C2-C..C25
Dc           
         [         R                  S:X  a  SSKn	U	R                  S5        U(       a  [        R
                  =p4[         R                  S:X  a5  SU;  a  [        R                  US'   OUS==   [        R                  -  ss'    [        R                  " U 4UX%X4US.UD6n
U
R                  (       a"  [        R                  S
U
R                   35        U
R                  (       a"  [        R                  SU
R                   35        U
$ ! [         a+    [         R                  S:X  a  SSKn	U	R                  S	5        e [        R                   am  nUR                  (       a"  [        R                  S
UR                   35        UR                  (       a"  [        R                  SUR                   35        UeSnAff = f)ab  
Create and run a subprocess.

Thin wrapper around `subprocess.run`, intended for testing.  Will
mark fork() failures on Cygwin as expected failures: not a
success, but not indicating a problem with the code either.

Parameters
----------
args : list of str
env : dict[str, str]
timeout : float
stdout, stderr
check : bool
text : bool
    Also called ``universal_newlines`` in subprocess.  I chose this
    name since the main effect is returning bytes (`False`) vs. str
    (`True`), though it also tries to normalize newlines across
    platforms.
capture_output : bool
    Set stdout and stderr to subprocess.PIPE

Returns
-------
proc : subprocess.Popen

See Also
--------
subprocess.run

Raises
------
pytest.skip
    If running on emscripten, which does not support subprocesses.
pytest.xfail
    If platform is Cygwin and subprocess reports a fork() failure.

emscriptenr   Nz(emscripten does not support subprocesseswin32creationflagsenvtimeoutcheckstdoutstderrtextcygwinzFork failurezSubprocess output:
zSubprocess error:
)sysplatformpytestskip
subprocessPIPECREATE_NO_WINDOWrunBlockingIOErrorxfailCalledProcessErrorr'   r   errorr(   debug)commandr$   r%   r'   r(   r&   r)   capture_outputkwargsr-   proces               r   subprocess_run_for_testingr=   6   sc   P |||#>?$//) ||w&(&0&A&AF?#?#z'B'BB#~~
	
  	
$ {{

)$++78{{

(67K!  <<8#LL((( 88JJ-ahhZ8988JJ,QXXJ78s   D AGA(F??G)	extra_envc                R   U R                   nU R                  nU R                  R                  n[	        [
        R                  SSU< SU< SU S3/UQ0 [        R                  ES[        R                  S.EU=(       d    0 EUS[        R                  [        R                  SS	9nU$ )
ag  
Run a function in a sub-process.

Parameters
----------
func : function
    The function to be run.  It must be in a module that is importable.
*args : str
    Any additional command line arguments to be passed in
    the first argument to ``subprocess.run``.
extra_env : dict[str, str]
    Any additional environment variables to be set for the subprocess.
-czEimport importlib.util;_spec = importlib.util.spec_from_file_location(z, z]);_module = importlib.util.module_from_spec(_spec);_spec.loader.exec_module(_module);_module.z()0)SOURCE_DATE_EPOCH-SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MATPLOTLIBTr#   )__name__
__module____code__co_filenamer=   r+   
executableosenvironr
   __version__r/   r0   )funcr%   r>   argstargetmodulefiler;   s           r   subprocess_run_helperrQ      s     ]]F__F==$$D%NN>>DZr$ R hb	"		
 		

jj
!$ >A__
 B
 9D< Kr   c           	      X   [        5        n[        US5      nUR                  SSS9   [        R                  " U SS[        U5      /U[        R                  [        R                  S9   SSS5        g
! [        [        R                  4 a     SSS5        g	f = f! , (       d  f       g= f)zx
Check if a given TeX system + pgf is available

Parameters
----------
texsystem : str
    The executable name to check
ztest.texz
            \documentclass{article}
            \usepackage{pgf}
            \begin{document}
            \typeout{pgfversion=\pgfversion}
            \makeatletter
            \@@end
        zutf-8)encodingz-halt-on-errorz-no-shell-escape)cwdr'   r(   NFT)	r   r   
write_textr/   
check_callstrDEVNULLOSErrorr5   )	texsystemtmpdirtex_paths      r   _check_for_pgfr]      s     
	
+   	 		!!,.@X %+!))*2D2DF # 
	 667 	! 
		 
	s/   BA A3)B3BBBB
B)c                 v     [         R                  R                  U  S35        g! [        [        4 a     gf = f)Nz.styTF)r
   dvireadfind_tex_fileFileNotFoundErrorrY   )packages    r   _has_tex_packagerc      s:    !!WIT"23w' s   "% 88c                    SS K nUR                  S5      n[        R                  S:X  a  UR	                  S5        UR
                  S S S:X  a  U S:X  a  UR	                  S5        UR                  5        H  u  pEUR
                  S S	 U:  d  M  Un  O   S
n[        SSSU  3SU/SSS9nUR                  R                  5       R                  SW S35      (       d   eg )Nr   IPythonr!   z>Cannot change backend running IPython in subprocess on Windows   )      r   osxz:Bug using macosx backend in IPython 8.24.0 fixed in 8.24.1   zpimport matplotlib as mpl, matplotlib.pyplot as plt;fig, ax=plt.subplots(); ax.plot([1, 3, 2]); mpl.get_backend()ipythonz--no-simple-promptz--matplotlib=r@   T)r&   r9   ')r-   importorskipr+   r,   r.   version_infoitemsr=   r'   stripendswith)	"requested_backend_or_gui_frameworkall_expected_backendsr-   re   min_versionbackendexpected_backendcoder;   s	            r   ipython_in_subprocessrx      s    !!),G
||wTURa J..%7PQ !6 ; ; =#{2& !>
LD% >?@$		
 	D ;;''!,<+=Q(?@@@@r   c                  X    / SQn U  H   n[         R                  " U5      (       d  M     g   g)N)CICONTINUOUS_INTEGRATIONTRAVISCIRCLECIJENKINS	GITLAB_CIGITHUB_ACTIONSTEAMCITY_VERSIONTF)rI   getenv)ci_environment_variablesenv_vars     r   is_ci_environmentr      s-    
  ,99W , r   c                    ^	 SS/n Sn[        US5       Vs/ s H  n[        U5      PM     nn[        SS5       Vs/ s H  n[        U5      PM     nn[        SS5       Vs/ s H  n[        U5      PM     nn[        SS5       Vs/ s H  n[        U5      PM     nn[        R                  " US	-
  5      m	S
R	                  S [        R
                  " / UQUQUQUQU	4S jS9 5       5      nS[        R                   S[        R                   S
[        R                   S[        R                   SU S3nX4$ s  snf s  snf s  snf s  snf )a6  
Generate text intended for use with multiple fonts to exercise font fallbacks.

Returns
-------
fonts : list of str
    The names of the fonts used to render the test string, sorted by intended
    priority. This should be set as the font family for the Figure or Text artist.
text : str
    The test string.
cmr10r         i  iP  i  i    
c              3   H   #    U  H  u  pS R                  U5      v   M     g7f) N)join).0_lines      r   	<genexpr>'_gen_multi_font_text.<locals>.<genexpr>+  s'      %-GA 	-s    "c                     > [        T5      S-  $ )N    )next)xcounts    r   <lambda>&_gen_multi_font_text.<locals>.<lambda>0  s    $u++r   )keyzThere are basic characters
 z
and accented characters
z
in between!)rangechr	itertoolsr   r   groupbystringascii_uppercaseascii_lowercasedigitspunctuation)
fontsstartr   latin1_supplementlatin_extended_Alatin_extended_Bnon_basic_multilingual_planenon_basic_characterstest_strr   s
            @r   _gen_multi_font_textr     sg    m$E
 E).uf)=>)=AQ)=>(-eW(=>(=1A(=>(-eW(=>(=1A(=>49'74K#L4KqCF4K #LOOEDL)E99 % ((, ,"2 ,5E ,*,+-%  &001 2q##$ %  	H ?) ?>>#Ls   D9D> EE)N<   NNFTF)__doc__r   r   loggingrI   pathlibr   r   r/   r+   tempfiler   r   r
   r   	getLoggerrD   r   r   r   r   r=   rQ   r]   rc   rx   r   r   r   r   r   <module>r      s       	    
 '  "-
0&2 FJ>B.3K\ ;? /d:AD*(r   