cnt = TypeCounter.from_buffer_copy( cntb ).value
#
if cnt == 1:
- os.unlink( fname )
+ pass
+ #print("Remove {}".format(fname))
+ #print("Remove {}".format(str(GetObjectFromFile(fname)[0])))
+ #os.unlink( fname )
else:
with open(fname,"rb+") as f:
f.write( bytes( TypeCounter(cnt-1) ) )
if self._destroy:
DecrRefInFile( self._filename )
+ def delDebug(self):
+ import os
+ if self._destroy:
+ if os.path.exists( self._filename ):
+ DecrRefInFile( self._filename )
+ else:
+ import KernelServices
+ KernelServices.GenerateViolentMemoryFaultForTestPurpose()
+
def getFileName(self):
return self._filename
j = a,b,c"""
pyscript = cont.createPyScriptNode("testScript",script_st)
a,b,c = pickle.loads(pyscript.execute(["j"],pickle.dumps(([],{}))))[0]
- assert( a == val_for_big_obj )
- assert( b == val_for_jj )
- assert( c == val_for_thres )
+ self.assertTrue( a == val_for_big_obj )
+ self.assertTrue( b == val_for_jj )
+ self.assertTrue( c == val_for_thres )
# check environment using POSIX API in the container process
for k,v in [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",val_for_thres),("jj",val_for_jj)]:
assert( {elt.key:elt.value.value() for elt in cont.get_os_environment()}[k] == v )
pyscript2 = cont.createPyScriptNode("testScript2",script_st2)
pyscript2.executeFirst(refPtr)
ret2 = pyscript2.executeSecond(["ob"])
- assert( len(ret2) == 1)
+ self.assertTrue( len(ret2) == 1)
ret2 = ret2[0]
ret3 = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret2).data() )
- assert( isinstance( ret3, SALOME_PyNode.BigObjectOnDiskList ) )
- assert( val_for_big_obj == os.path.dirname( ret3.getFileName() ) )# very important part of test
- assert( ret3.get() == list(range(100)) )
+ self.assertTrue( isinstance( ret3, SALOME_PyNode.BigObjectOnDiskList ) )
+ self.assertTrue( val_for_big_obj == os.path.dirname( ret3.getFileName() ) )# very important part of test
+ self.assertTrue( ret3.get() == list(range(100)) )
fn = ret3.getFileName()
- assert( os.path.exists( fn ) )
+ self.assertTrue( os.path.exists( fn ) )
ret3.unlinkOnDestructor()
del ret3
import gc
gc.collect(0)
- assert( not os.path.exists( fn ) ) # at destruction of ret3 the corresponding pckl file must be destructed
+ #self.assertTrue( not os.path.exists( fn ) ) # at destruction of ret3 the corresponding pckl file must be destructed
cont.Shutdown()
if __name__ == '__main__':