-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import os | ||
import shutil | ||
import unittest | ||
import tempfile | ||
import timeout_decorator | ||
import fuse | ||
import straxen | ||
from _utils import test_root_file_name | ||
|
||
TIMEOUT = 240 | ||
|
||
|
||
class TestTruthPlugins(unittest.TestCase): | ||
__test__ = True | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
cls.temp_dir = tempfile.TemporaryDirectory() | ||
|
||
cls.test_context = fuse.context.full_chain_context( | ||
output_folder=cls.temp_dir.name, run_without_proper_corrections=True | ||
) | ||
|
||
cls.test_context.set_config( | ||
{ | ||
"path": cls.temp_dir.name, | ||
"file_name": test_root_file_name, | ||
"entry_stop": 5, | ||
} | ||
) | ||
|
||
cls.run_number = "TestRun_00000" | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
cls.temp_dir.cleanup() | ||
|
||
def setUp(self): | ||
downloader = straxen.MongoDownloader(store_files_at=(self.temp_dir.name,)) | ||
downloader.download_single(test_root_file_name, human_readable_file_name=True) | ||
|
||
assert os.path.exists(os.path.join(self.temp_dir.name, test_root_file_name)) | ||
|
||
self.test_context.make(self.run_number, "photon_summary") | ||
self.test_context.make(self.run_number, "raw_records") | ||
|
||
def tearDown(self): | ||
# self.temp_dir.cleanup() | ||
shutil.rmtree(self.temp_dir.name) | ||
os.makedirs(self.temp_dir.name) | ||
|
||
@timeout_decorator.timeout(TIMEOUT, exception_message="RecordsTruth timed out") | ||
def test_RecordsTruth(self): | ||
self.test_context.make(self.run_number, "records_truth") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |