\bgfdZddlZddlZddlZddlZddlZGddZGddZdS)z develop testsNc6eZdZdZedZdZdZdS) TestSandboxctjt|5|t jddddS#1swxYwYdSN) setuptoolssandboxDirectorySandboxstr _file_writerosdevnull)selftmpdirs n/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/tests/test_sandbox.py test_devnullzTestSandbox.test_devnull s   0 0V = = * *   bj ) ) ) * * * * * * * * * * * * * * * * * *s AA!Acfd}|S)Nctdd5}|dddddS#1swxYwYdS)Nwutf-8encodingxxx)openwrite)fpaths rdo_writez*TestSandbox._file_writer..do_writesdC'222 a                  s 7;;)rrs` rr zTestSandbox._file_writers#     ctjtd}tjd}t j|t||j dksJdS)zT It should be possible to execute a setup.py with a Byte Order Mark zscript-with-bom.py namespacepassedN) pkg_resourcesresource_filename__name__types ModuleTyperr _execfilevarsresult)rtargetr!s rtest_setup_py_with_BOMz"TestSandbox.test_setup_py_with_BOMs`0;OPP$[11 $$VT)__===8++++++rc|dz }|d5}|ddddn #1swxYwYtjt |t dS)Nzsetup.pywbs"degenerate script" )rrrrr(r globals)rrsetup_pystreams rtest_setup_py_with_CRLFz#TestSandbox.test_setup_py_with_CRLF"sJ& ]]4  5F LL3 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5$$S]]GII>>>>>s=AAN)r% __module__ __qualname__r staticmethodr r,r2rrrrr s\***\,,,?????rrc8eZdZdZdZdZdZdZdZdZ dS) TestExceptionSavercxtj5td#1swxYwYdSNdetails)rrExceptionSaver ValueErrorrs rtest_exception_trappedz)TestExceptionSaver.test_exception_trapped*sa   . . 0 0 ( (Y'' ' ( ( ( ( ( ( ( ( ( (s /33cntj5}td#1swxYwYt jt5}|dddn #1swxYwYt|jtsJt|jdksJdSr9) rrr;r<pytestraisesresume isinstancevaluer )r saved_exccaughts rtest_exception_resumedz)TestExceptionSaver.test_exception_resumed.s   . . 0 0 (IY'' ' ( ( ( ( ( ( ( (]: & & &                     &, 333336<  I------s/33A44A8;A8cTtd}tj5}|#1swxYwYt jt5}|dddn #1swxYwYt|jtsJ|j|usJdSr9) r<rrr;r@rArBrCrD)rorig_excrErFs rtest_exception_reconstructedz/TestExceptionSaver.test_exception_reconstructed8si((   . . 0 0 IN        ]: & & &                     &, 33333|8++++++s155A66A:=A:ctj5} dddn #1swxYwY|dSr)rrr;rB)rrEs r test_no_exception_passes_quietlyz3TestExceptionSaver.test_no_exception_passes_quietlyDs   . . 0 0 I                 s -11chGddt}tj5}|d#1swxYwYt jtjj5}|dddn #1swxYwYt|j dksJdS)NceZdZdZdefdZdS)FTestExceptionSaver.test_unpickleable_exception..CantPickleThisz:This Exception is unpickleable because it's not in globalsreturncd|jS)NCantPickleThis)argsr=s r__repr__zOTestExceptionSaver.test_unpickleable_exception..CantPickleThis.__repr__Ns-1YY88rN)r%r3r4__doc__r rTrrrrRrOKs5 H H 9# 9 9 9 9 9 9rrRdetailzCantPickleThis('detail',)) Exceptionrrr;r@rAUnpickleableExceptionrBr rD)rrRrErFs rtest_unpickleable_exceptionz.TestExceptionSaver.test_unpickleable_exceptionJs" 9 9 9 9 9Y 9 9 9   . . 0 0 +I .** * + + + + + + + +]:-C D D                      6<  $???????s! >AA,B  BBcdGddt}tjtjj5}tj5tj|#1swxYwY dddn #1swxYwY|jj \}|dksJdS)z As revealed in #440, an infinite recursion can occur if an unpickleable exception while setuptools is hidden. Ensure this doesn't happen. ceZdZdZdS)aTestExceptionSaver.test_unpickleable_exception_when_hiding_setuptools..ExceptionUnderTestzE An unpickleable exception (not in globals). N)r%r3r4rUrrrExceptionUnderTestr\_s    rr]NzExceptionUnderTest()) rWr@rArrrX save_moduleshide_setuptoolsrDrS)rr]rFmsgs r2test_unpickleable_exception_when_hiding_setuptoolszETestExceptionSaver.test_unpickleable_exception_when_hiding_setuptoolsYs#          ]:-C D D )#0022 ) )"22444(( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ",,,,,,,s/B!A77A; ;B>A; ?BBBcfd}tjtjj5}tj5tjtjt|5|dddn #1swxYwYdddn #1swxYwYdddn #1swxYwY|j j \}}}|dksJ|dksJ|ddiksJt|j }d|vsJd|vsJd|vsJdS) z When in a sandbox with setuptools hidden, a SandboxViolation should reflect a proper exception and not be wrapped in an UnpickleableException. c^tddd5 ddddS#1swxYwYdS)z9Trigger a SandboxViolation by writing outside the sandbox/etc/foorrrN)rrrr write_filezVTestExceptionSaver.test_sandbox_violation_raised_hiding_setuptools..write_filess~j#888                    s "&&Nr)rdrrrz('/etc/foo', 'w')z{'encoding': 'utf-8'}) r@rArrSandboxViolationr^r_r r rDrS)rrrerFcmdrSkwargsr`s r/test_sandbox_violation_raised_hiding_setuptoolszBTestExceptionSaver.test_sandbox_violation_raised_hiding_setuptoolsls    ]:-> ? ? !6#0022 ! !"22444'88VEE!!JLLL!!!!!!!!!!!!!!! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! #L-T6f}}}}(((((*g.....&,}}}}"c))))&#------sZCA B? B( B?(B, ,B?/B, 0B?3 C?C CC CCCN) r%r3r4r>rGrJrLrYrarirrrr7r7)s(((... , , , @ @ @---&.....rr7) rUr r&r@r#setuptools.sandboxrrr7rrrrks ????????:].].].].].].].].].].r