a ze@svdZddlZddlZddlZddlmZeedr)z(AuditTest.run_python..r ) r rrrrrrr rrr r)rreventsrrrr run_pythons zAuditTest.run_pythoncCs|ddS)N test_basicrrrrrr'-szAuditTest.test_basiccCs|ddS)Ntest_block_add_hookr(r)rrrr*0szAuditTest.test_block_add_hookcCs|ddS)N!test_block_add_hook_baseexceptionr(r)rrrr+3sz+AuditTest.test_block_add_hook_baseexceptioncCstd|ddS)Nmarshal test_marshalr import_modulerr)rrrr-6s zAuditTest.test_marshalcCstd|ddS)Npickle test_pickler.r)rrrr1;s zAuditTest.test_picklecCs|ddS)Ntest_monkeypatchr(r)rrrr2@szAuditTest.test_monkeypatchcCs|dtjdS)N test_open)rrZTESTFNr)rrrr3CszAuditTest.test_opencCs|ddS)N test_cantracer(r)rrrr4FszAuditTest.test_cantracecCs|ddS)N test_mmapr(r)rrrr5IszAuditTest.test_mmapcCs6|d\}}}|s$|d||dg|dS)Ntest_excepthookzExpected fatal exception )zsys.excepthookrzRuntimeError('fatal-error'))r&rassertSequenceEqualrrr%r rrrr6Ls zAuditTest.test_excepthookcCsJ|d\}}}|r||||ddd||ddddS)Ntest_unraisablehookrzsys.unraisablehookzDRuntimeError('nonfatal-error') Exception ignored for audit hook test)r&r assertEqualr8rrrr9Us  zAuditTest.test_unraisablehookcCstd|d\}}}|r(||||ddd||ddd|dd}|||dd |d g|d|dd |d g|d |d d |g|ddS)Nwinreg test_winregrzwinreg.OpenKeyzwinreg.OpenKey/resultr:zwinreg.EnumKeyrz 0z 10000zwinreg.PyHKEY.Detach)rr/r&rr; assertTruer7)rrr%r Zexpectedrrrr=`s    zAuditTest.test_winregcCstd|d\}}}|r(||tjrzsocket.__new__r:z socket.bindz('127.0.0.1', 8080)) rr/r&rverboseprintr;rAendswithr8rrrrCns  zAuditTest.test_socketcCsP|d\}}}|r||tjr2t|ddi|dd|DgddS)Ntest_gcrDrEcSsg|] }|dqS)rr)r!eventrrrr#r$z%AuditTest.test_gc..)zgc.get_objectszgc.get_referrerszgc.get_referents)r&rrrFrGr;r8rrrrI{s  zAuditTest.test_gcN)__name__ __module__ __qualname__rr&r'r*r+r-r1r2r3r4r5r6r9r=rCrIrrrrrs     r__main__)__doc__r rZunittesttestrhasattrZSkipTestZfindfilerZTestCaserrKmainrrrrs   y