
    sg                     T    d Z ddlZddlZddlmZmZmZmZ ddlZddl	m
Z
 e
d        Zy)a  
Checks that SymPy does not contain indirect imports.

An indirect import is importing a symbol from a module that itself imported the
symbol from elsewhere. Such a constellation makes it harder to diagnose
inter-module dependencies and import order problems, and is therefore strongly
discouraged.

(Indirect imports from end-user code is fine and in fact a best practice.)

Implementation note: Forcing Python into actually unloading already-imported
submodules is a tricky and partly undocumented process. To avoid these issues,
the actual diagnostic code is in bin/diagnose_imports, which is run as a
separate, pristine Python process.
    N)abspathdirnamejoinnormpath)XFAILc                     t        t        j                  t        j                                     } t	        |       }t        |d      }t        |      }t        j                  t        j                  t        |      ddgt        j                  t        j                  d      }|j                         \  }}|dk(  sJ d|j                         z          y )Nzdiagnose_imports.pyz
--problemsz--by-importer)stdoutstderrbufsize zThere are import problems:
)r   inspectgetfilecurrentframer   r   r   
subprocessPopensys
executablePIPESTDOUTcommunicatedecode)my_filename
my_dirnamediagnose_imports_filenameprocessoutput_s         Z/var/www/html/venv/lib/python3.12/site-packages/sympy/testing/tests/test_module_imports.pytest_module_imports_are_directr       s    '//'*>*>*@ABK%J $Z1F G ()B CNN./		
   	G ##%IFAR<I7&--/II<    )__doc__r   r   os.pathr   r   r   r   r   sympy.testing.pytestr   r     r!   r   <module>r&      s2      
 4 4  &J Jr!   