def test_process(self): try: plugin = pu.load_plugin(self.plugin_name) if self.plugin_name == base_class_name: self.assertRaises(NotImplementedError, plugin.process, "test", "test", 1, 1) return # load appropriate data data = tu.get_appropriate_input_data(plugin) self.assertGreater(len(data), 0, "Cannot find appropriate test data") # generate somewhere for the data to go output = tu.get_appropriate_output_data(plugin, data) self.assertGreater(len(output), 0, "Cannot create appropriate output data") plugin.set_parameters(None) for i in range(len(data)): plugin.run_process(data[i], output[i], ["CPU0"], 0) print("Output from plugin under test ( %s ) is in %s" % (plugin.name, output[i].backing_file.filename)) data[i].complete() output[i].complete() except ImportError as e: print( "Failed to run plugin test as libraries not available (%s), passing test" % (e)) pass
def test_process(self): try: plugin = pu.load_plugin(self.plugin_name) if self.plugin_name == base_class_name: self.assertRaises(NotImplementedError, plugin.process, "test", "test", 1, 1) return # load appropriate data data = tu.get_appropriate_input_data(plugin) self.assertGreater(len(data), 0, "Cannot find appropriate test data") # generate somewhere for the data to go output = tu.get_appropriate_output_data(plugin, data) self.assertGreater(len(output), 0, "Cannot create appropriate output data") plugin.set_parameters(None) for i in range(len(data)): plugin.run_plugin(data[i], output[i], ["CPU0"], 0) print("Output from plugin under test ( %s ) is in %s" % (plugin.name, output[i].backing_file.filename)) data[i].complete() output[i].complete() except ImportError as e: print("Failed to run plugin test as libraries not available (%s), passing test" % (e)) pass
def test_create_smaller_data_block(self): data = tu.get_nx_tomo_test_data() plugin = pu.load_plugin("savu.plugins.downsample_filter") output = tu.get_appropriate_output_data(plugin, data)[0] self.assertEqual(output.get_data_shape(), (111, 68, 80))
logging.debug("Loading plugin %s", options.plugin) plugin = pu.load_plugin(None, options.plugin) logging.debug("Loaded plugin %s", options.plugin) # load appropriate data logging.debug("Loading test data") data = tu.get_appropriate_input_data(plugin) if data is None: logging.error("Cannot create appropriate input data") raise Exception("Cannot create appropriate input data") # generate somewhere for the data to go logging.debug("Sorting out output data") output = \ tu.get_appropriate_output_data(plugin, data, mpi=True, file_name=global_data['file_name']) if output is None: logging.error("Cannot create appropriate output data") raise Exception("Cannot create appropriate output data") plugin.set_parameters(None) for i in range(len(data)): logging.debug("processing") plugin.run_process(data[i], output[i], ALL_PROCESSES, RANK) logging.debug("Processed to file : %s", output[i].backing_file.filename) data[i].complete() output[i].complete()