
    Q3jJ                         d dl Z d dlZ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m	Z	 ej                  j                  d        Zd Zy)    N)__version__)_openmp_parallelism_enabledc                     t         j                  j                  t        j                        g} g }t        j                  | dd       D ]  \  }}}|sd|v sd|v sd|v sd|v rt        j                  |      }t        |dd	      xs d	}|j                  d
      sRt        j                  |t        j                        D ]W  \  }}	 t        j                  |      }	|	|k7  r"|j                   |k7  s2|j#                  | d| d|j                   d|       Y  |rJ ddj%                  |      z          y# t        $ r Y w xY w)a  Check that Cython extension types have a correct ``__module__``.

    When a subpackage containing Cython extension types has a misconfigured
    ``meson.build`` (e.g. missing ``__init__.py`` in its Cython tree), Cython
    cannot detect the package hierarchy and sets ``__module__`` to just the
    submodule name (e.g. ``'_loss'``) instead of the fully qualified
    ``'sklearn._loss._loss'``. This breaks downstream tools like skops that
    rely on ``__module__`` for serialization.
    zsklearn.c                      y )N )_s    E/DATA/.local/lib/python3.12/site-packages/sklearn/tests/test_build.py<lambda>z,test_extension_type_module.<locals>.<lambda>   s        )pathprefixonerrorz.tests.z.externals.z._build_utils.z._cyutility__file__ )z.soz.pyd.z.__module__ == z, expected z+Extension types with incorrect __module__:

N)osr   dirnamesklearnr   pkgutilwalk_packages	importlibimport_modulegetattrendswithinspect
getmembersisclassgetfile	TypeError
__module__appendjoin)
sklearn_pathfailuresr   modnameispkgmodmod_filenameclscls_files
             r	   test_extension_type_moduler-      sd    GGOOG$4$456LH$22*n7E G#'7*'%%g.3
B/52   1 ++CAID#"??3/ 8#~~(iqocnn5G H  '{, B3T  G$))K  <x   s   D88	EEc                      t        j                  d      rt        j                  d       t	        j
                  d      rdnd} t        j                  d      j                  |       }t               sJ |       y )NSKLEARN_SKIP_OPENMP_TESTz2test explicitly skipped (SKLEARN_SKIP_OPENMP_TEST)z.dev0devstablea  
        This test fails because scikit-learn has been built without OpenMP.
        This is not recommended since some estimators will run in sequential
        mode instead of leveraging thread-based parallelism.

        You can find instructions to build scikit-learn with OpenMP at this
        address:

            https://scikit-learn.org/{}/developers/advanced_installation.html

        You can skip this test by setting the environment variable
        SKLEARN_SKIP_OPENMP_TEST to any value.
        )
r   getenvpytestskipr   r   textwrapdedentformatr   )base_urlerr_msgs     r	   test_openmp_parallelism_enabledr:   J   sg     
yy+,HI#,,W5u8Hoo	 fX   '(1'1(r   )r   r   r   r   r5   r3   r   r   sklearn.utils._openmp_helpersr   markthread_unsafer-   r:   r   r   r	   <module>r>      sD      	      E 8 8v2r   