def testSlurmConstruct(self): singfel_cmd = getSingfelCommand(uniform_rotation=None, back_rotation=True, number_of_diffraction_patterns=1, calculate_Compton=0, orientation=(1, 0, 0, 0)) singfelSlurm('Test', './', singfel_cmd, nodes=2).writeScript()
def testCleanup(self): with open('diffr.h5', 'w'): pass os.mkdir('diffr') singfel_cmd = getSingfelCommand(uniform_rotation=None, back_rotation=True, number_of_diffraction_patterns=1, calculate_Compton=0, orientation=(1, 0, 0, 0), pmi_stop_ID=20) capturedOutput = io.StringIO() # Create StringIO object sys.stdout = capturedOutput # and redirect stdout. singfelSlurm('Test', './', singfel_cmd, slurm_file='test.slrum', nodes=2, is_cleanup=True).submit(test=True) sys.stdout = sys.__stdout__ # Reset redirect. string_out = capturedOutput.getvalue() # Now works as before. print(string_out) self.assertNotEqual(string_out.find('diffr.h5 exists: True'), -1) self.assertNotEqual(string_out.find('diffr exists: True'), -1) self.assertFalse(os.path.isfile('diffr.h5')) self.assertFalse(os.path.isdir('diffr'))
def testSlurmGeom(self): singfel_cmd = getSingfelCommand(uniform_rotation=None, back_rotation=True, number_of_diffraction_patterns=1, calculate_Compton=0, orientation=(1, 0, 0, 0), geomFile='../my.geom') self.assertNotEqual(singfel_cmd.find("--geomFile ../my.geom"), -1)
def testOrientationNormal(self): """Testing orientation command""" singfel_cmd = getSingfelCommand(uniform_rotation=None, back_rotation=True, number_of_diffraction_patterns=1, calculate_Compton=0, orientation=(1, 0, 0, 0)) self.assertNotEqual(singfel_cmd.find("--orientation"), -1)
def testSlurmPMISTOP(self): singfel_cmd = getSingfelCommand(uniform_rotation=None, back_rotation=True, number_of_diffraction_patterns=1, calculate_Compton=0, orientation=(1, 0, 0, 0), pmi_stop_ID=20) singfelSlurm('Test', './', singfel_cmd, slurm_file='test.slrum', nodes=2).writeScript()