K i@ddlZddlZddlmZddlmZGddZy)N)paths_on_pythonpath) namespacesc$eZdZdZdZdZdZy)TestNamespacesc Ftj|d}tj|d}|dz }|dz }||f}tjdddt |dt |g}t j |tj|tjdddt |dt |g}t j |tjd d g}ttt|5t j |d d d y #1swYy xYw) z Installing two packages sharing the same namespace, one installed to a site dir and the other installed just to a path on PYTHONPATH should leave the namespace in tact and both packages reachable by import. myns.pkgA myns.pkgBz site-packagesz path-packages-m pip.__main__install-t-cz"import myns.pkgA; import myns.pkgBN) rbuild_namespace_packagesys executablestr subprocess check_call make_site_dirrmap) selftmpdirpkg_Apkg_B site_packages path_packagestargets install_cmd try_imports f/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/tests/test_namespaces.pytest_mixed_site_and_non_sitez+TestNamespaces.test_mixed_site_and_non_site s226;G226;G0 0 . NN    J     k*  / NN    J     k* NN  0 !S'!2 3 .  ! !* - . . .s 8DD c tj|d}|dz }|jtjddddt |t |g}t t |g5tj|dddtj|tjdd g}t t |g5tj|dddy#1swYexYw#1swYyxYw) zc Ensure that a namespace package doesn't break on import of pkg_resources. r packagesr pipr rNrzimport pkg_resources) rrmkdirrrrrrrr)rrpkgtargetrr s r!test_pkg_resources_importz(TestNamespaces.test_pkg_resources_import4s 00E*$  NN     K H !#f+ / /  ! !+ . /  ( NN  " !#f+ / .  ! !* - . . / / . .s*C$C0$C-0C9c tj|d}|dz }tjdddt |dt |g}t j |tj|tjddg}tt |g5t j |t | d d d y #1swYy xYw) z Installing a namespace packages but also having it in the current working directory, only one version should take precedence. r r$r r r rrz&import pkg_resources; import myns.pkgAcwdN rrrrrrrrr)rrrr(rpkg_resources_imps r!(test_namespace_package_installed_and_cwdz7TestNamespaces.test_namespace_package_installed_and_cwdPs 226;G*$ NN    J  K  k*  ( NN  4  !#f+ / E  ! !"3U D E E Es !CC c tj|d}tj|d}|dz }tjdddt |dt |g}t j |tj|tjdd g}tt |g5t j |t | d d d y #1swYy xYw) z Installing one namespace package and also have another in the same namespace in the current working directory, both of them must be importable. r r r$r r r rrz8import pkg_resources; import myns.pkgA; import myns.pkgBr+Nr-)rrrrr(rr.s r!5test_packages_in_the_same_namespace_installed_and_cwdzDTestNamespaces.test_packages_in_the_same_namespace_installed_and_cwdms 226;G226;G*$ NN    J  K  k*  ( NN  F  !#f+ / E  ! !"3U D E E Es -!CC N)__name__ __module__ __qualname__r"r)r/r1r!rr s(.T.8E:Er6r)rrsetuptools._pathrrrr5r6r!r9s 0AEAEr6