
    tfJ#              
          d dl Z d dlZd dlZd dlZd dlZd dlmZ d dl	Z	d dl
Z
d dlmZ d dlmZ d dlmZ d dlmZmZ d Zd Zd Z e	j.                  d	d
      d        ZdeiZer eee      r	 d dlZej;                  dei       	 d dlZej;                  dei        ej@                  e       	 d dl!Z!ej;                  de!i        ejD                         dvr, e jF                  e      Z$de$v rn	 e$D  ci c]  } | e|    
 c} Zdev rdZe	jR                  jU                  dejW                               Z,e	j.                  d        Z-e
j\                  j_                  ej`                  jc                   ejd                         d             e
jf                  ji                  ddd
       e
jf                  ji                  ddd
dd
 e5e
jl                               ejn                  jq                  dd      Z9e
jf                  ju                  e9       y# e$ r Y w xY w# e$ r Y xw xY w# e$ r Y lw xY wc c} w # e%$ r dejM                          Z' e(e'      w xY w)    N)get_fpu_mode)FPUModeChangeWarning)_pep440)SCIPY_ARRAY_APISCIPY_DEVICEc                     | j                  dd       | j                  dd       | j                  dd       	 dd l}| j                  dd       y # t        $ r | j                  dd       Y 0w xY w)Nmarkerszslow: Tests that are very slow.zHxslow: mark test as extremely slow (not run unless explicitly requested)z8xfail_on_32bit: mark test as failing on 32-bit platformsr   z.timeout: mark a test for a non-default timeoutzskip_if_array_api(*backends, reasons=None, np_only=False, cpu_only=False): mark the desired skip configuration for the `skip_if_array_api` fixture.)addinivalue_linepytest_timeout	Exception)configr   s     X/var/www/html/software/conda/envs/higlass/lib/python3.12/site-packages/scipy/conftest.pypytest_configurer      s    
I)+
IRT
IBDI I	ST  IG	IIs   A A-,A-c                     t        j                  t        j                        t        j                  d      k\  r| j                  |      }|S | j                  |      }|S )Nz3.6.0)r   parsepytest__version__Versionget_closest_marker
get_marker)itemnamemarks      r   	_get_markr   #   sN    }}V''(GOOG,DD&&t, K t$K    c                 Z   t        | d      }|A	 t        t        j                  j	                  dd            }|st        j                  d       t        | d      }|Gt        j                  d      j                  dk  r%t        j                  d	|j                  d           t        j                         5 }|j                  t        j                          	 dd
lm} d}|rc	 t        t        j                  d         }t        j*                  d      s1t        j,                         dz  }t/        ||z  d      }	  |d       d d d        y # t
        $ r d}Y %w xY w# t&        $ r d}Y w xY w# t(        $ r Y d d d        y w xY w# t&        $ r Y d d d        y w xY w# 1 sw Y   y xY w)NxslowSCIPY_XSLOW0Fz@very slow test; set environment variable SCIPY_XSLOW=1 to run itxfail_on_32bitr      z&Fails on our 32-bit test platform(s): )threadpool_limitsTPYTEST_XDIST_WORKER_COUNTOMP_NUM_THREADS      blas)user_api)r   intosenvironget
ValueErrorr   skipnpintpitemsizexfailargsnptsuppress_warningsfilter PytestUnraisableExceptionWarningthreadpoolctlr"   r   KeyErrorgetenv	cpu_countmax)	r   r   vsupr"   HAS_THREADPOOLCTLxdist_worker_countmax_openmp_threadsthreads_per_workers	            r   pytest_runtest_setuprC   +   s   T7#D	BJJNN=#67A KK K LT+,DBGGAJ//!3=diil^LM 
			  C

6::;	&7 $
 
%(4O)P%Q"
 99./%'\\^q%8"%();?Q)QST%U"%&86J5   	A	$  	& %	&  ) $ !  = 67 s   )E 9 F!E""F!%E3;F!=
F
EE"E0-F!/E00F!3	F<F!FF!
	FF!FF!!F*functionT)scopeautousec              #      K   t               }d t               }||k7  r&t        j                  d|dd|ddt        d       yyw)z9
    Check FPU mode was not changed during the test.
    NzFPU mode changed from z#xz to z during the testr   )category
stacklevel)r   warningswarnr   )requestold_modenew_modes      r   check_fpu_moderO   \   sT     
 ~H	~H8.xm4} M! !3	C s   AAnumpyarray_api_strictpytorchcupy)1trueallz!'--array-api-backend' must be in cudaxpc                    d|j                   vry|j                   d   j                  }|j                   d   j                  }|j                  dd      }|j                  dd      }|r>|j                  ddg      }|d   }| j                  d	k7  rt        j                  |
       y|rd}t        rt        dk7  rv| j                  dk(  rt        j                  |
       nP| j                  dk(  rAdt        j                  d      j                  j                  vrt        j                  |
       |Y|j                  dd      }t        |      D ]8  \  }}	| j                  |	k(  s|sd|	 }n||   }t        j                  |
       : yy)a  
    Skip based on the ``skip_if_array_api`` marker.

    Parameters
    ----------
    *backends : tuple
        Backends to skip, e.g. ``("array_api_strict", "torch")``.
        These are overriden when ``np_only`` is ``True``, and are not
        necessary to provide for non-CPU backends when ``cpu_only`` is ``True``.
    reasons : list, optional
        A list of reasons for each skip. When ``np_only`` is ``True``,
        this should be a singleton list. Otherwise, this should be a list
        of reasons, one for each corresponding backend in ``backends``.
        If unprovided, default reasons are used. Note that it is not possible
        to specify a custom reason with ``cpu_only``. Default: ``None``.
    np_only : bool, optional
        When ``True``, the test is skipped for all backends other
        than the default NumPy backend. There is no need to provide
        any ``backends`` in this case. To specify a reason, pass a
        singleton list to ``reasons``. Default: ``False``.
    cpu_only : bool, optional
        When ``True``, the test is skipped on non-CPU devices.
        There is no need to provide any ``backends`` in this case,
        but any ``backends`` will also be skipped on the CPU.
        Default: ``False``.
    skip_if_array_apiNnp_onlyFcpu_onlyreasonsz#do not run with non-NumPy backends.r   rP   )reasonz4do not run with `SCIPY_ARRAY_API` set and not on CPUcpurS   torchz#do not run with array API backend: )keywordsr3   kwargsr,   __name__r   r.   r   r   r`   emptydevicetype	enumerate)
rX   rL   backendsrb   r[   r\   r]   r^   ibackends
             r   rZ   rZ      s_   8 '"2"22 3499H1299FjjE*Gzz*e,H**Y)N(OP;;'!KKv&G|u4{{f$6*'A 5 5 : ::KKv.**Y.#H- 	+JAw{{g%B7)LF$QZF6*	+ r   z.hypothesisnondeterministic)r   deadline
print_blobdeterministic)r   rl   rm   databasederandomizesuppress_health_checkSCIPY_HYPOTHESIS_PROFILE);jsonr*   rJ   tempfilerP   r/   numpy.testingtestingr4   r   
hypothesisscipy._lib._fpumoder   scipy._lib._testutilsr   
scipy._libr   scipy._lib._array_apir   r   r   r   rC   fixturerO   xp_available_backends
isinstancestrrQ   updateImportErrorr`   set_default_devicerS   lowerloadsSCIPY_ARRAY_API_r9   keysmsgr-   r   parametrizevaluesarray_api_compatiblerZ   configurationset_hypothesis_home_dirpathjoin
gettempdirsettingsregister_profilelistHealthCheckr+   r,   rr   load_profile)rj   s   0r   <module>r      s    	       , 6  ?T".b j$/C 0C !" z/37$$&8:J%KL$$i%78   .$$fd^4
 m3%4::o6$$& $4) 27;;)% 
""L{{..t5J5Q5Q5ST  7+ 7+z    0 0GGLL$$$&6    $ $	dt %     $ $	dTtz556 %  ::>>*D*9;  
      !9 :w      )  &9:O:T:T:V9WX o%&sT   0H )H! 2H- 4H> 8H9H> HH!H*)H*-H65H69H> >!I