
    Zd                        d Z ddlZddlZddlmZmZmZ ddlZddlZ ej	        d           ej
                            ej                  Zd Z ed          Z ed          Zd Zej
                            e          rd	  ej        e          D             Zej                            ej
                            e           d
          ej                            de          d                         Zej
                            e          rd  ej        e          D             Zej                            de          d             ZdS )z
Test our typing with mypy
    N)PIPESTDOUTPopenmypyc                     t           j                            t           j                            t                    |           }t           j                            |          s| }|S )zResolve a dir in the repo

    Resolved relative to zmq dir

    fallback on CWD (e.g. test run from repo, zmq installed, not -e)
    )ospathjoindirnamezmq_direxists)r	   resolved_paths     3lib/python3.11/site-packages/zmq/tests/test_mypy.pyresolve_repo_dirr      sJ     GLL!9!94@@M 7>>-((     examples
mypy_testsc                     t          t          j        ddgt          |           z   t          t
                    }|                                \  }}|                    dd          }t          |           |j	        dk    s
J |            dS )zFRun mypy for a path

    Captures output and reports it on errors
    z-mr   )stdoutstderrutf8replacer   N)
r   sys
executablelistr   r   communicatedecodeprint
returncode)	mypy_argspo_outs        r   run_mypyr%   $   s    
 		v&i8f	 	 	A ==??DAq
((69
%
%C	#JJJ<1cr   c                     g | ]F}t           j                            t           j                            t          |                    D|GS  )r   r	   isdirr
   examples_dir).0ds     r   
<listcomp>r,   3   sL       7==lA6677	  r   z!only test from examples directory)reasonexamplec                 p    t           j                            t          |           }t	          d|           d S Nz--disallow-untyped-calls)r   r	   r
   r)   r%   )r.   example_dirs     r   test_mypy_exampler2   :   s0    
 ',,|W55K'55555r   c                 <    g | ]}|                     d           |S )z.py)endswith)r*   r!   s     r   r,   r,   D   s)    GGGQZZ5F5FG!GGGr   filenamec                 l    t          dt          j                            t          |                      d S r0   )r%   r   r	   r
   mypy_dir)r5   s    r   	test_mypyr8   G   s)    'h)I)IJJJJJr   )__doc__r   r   
subprocessr   r   r   pytestzmqimportorskipr	   r   __file__r   r   r)   r7   r%   r   listdirr   markskipifparametrizer2   r   r8   r'   r   r   <module>rC      s    
			 



 * * * * * * * * * *  



  F   
'//#,
'
'    
++L))" " " 7>>,  L))  H 
|$$$-P    H--6 6 .- 6
 7>>( HGGZRZ11GGGJ Z00K K 10K K Kr   