File indexing completed on 2024-11-15 10:02:46
0001 import os
0002 import shutil
0003 import unittest
0004 import wget
0005
0006 from pyjano.jana.generator import generate_mini_plugin
0007 from pyjano.jana import Jana, PluginFromSource
0008
0009
0010 class MyTestCase(unittest.TestCase):
0011
0012 def setUp(self) -> None:
0013 self.plugin_name = "test_mini_plugin"
0014 self.this_dir = os.path.dirname(__file__)
0015 self.plugin_path = os.path.join(self.this_dir, self.plugin_name)
0016
0017 if os.path.isdir(self.plugin_path):
0018 shutil.rmtree(self.plugin_path, ignore_errors=True)
0019
0020
0021
0022 self.file_name = 'beagle_eD.txt'
0023
0024 def test_something(self):
0025 generate_mini_plugin(plugin_name=self.plugin_name, class_name="TestMiniPlugin")
0026
0027 my_plugin = PluginFromSource(self.plugin_path)
0028 self.assertEqual(my_plugin.name, self.plugin_name)
0029
0030 jana = Jana(nevents=5, output='test_miniplugin_output.root')
0031 jana.plugin('beagle_reader') \
0032 .plugin(my_plugin, verbose=2) \
0033 .source(self.file_name) \
0034 .run(retval_raise=True)
0035
0036
0037
0038 if __name__ == '__main__':
0039 unittest.main()