Skip to content

Commit

Permalink
Disable warnings for process_events test
Browse files Browse the repository at this point in the history
Prevent Travis CI failure in case of warnings
  • Loading branch information
Arne de Laat committed Aug 20, 2014
1 parent 4e1d6ac commit 3fd4d33
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sapphire/tests/analysis/test_process_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import tables
import sys
import warnings

from mock import patch

Expand All @@ -18,11 +19,13 @@
'Missing test datafile.')
class ProcessEventsTests(unittest.TestCase):
def setUp(self):
warnings.filterwarnings('ignore')
self.data_path = self.create_tempfile_from_testdata()
self.data = tables.open_file(self.data_path, 'a')
self.proc = process_events.ProcessEvents(self.data, DATA_GROUP, progress=False)

def tearDown(self):
warnings.resetwarnings()
self.data.close()
os.remove(self.data_path)

Expand All @@ -49,8 +52,10 @@ def test_first_above_threshold(self):
self.assertEqual(self.proc.first_above_threshold(trace, 4), 2)
self.assertEqual(self.proc.first_above_threshold(trace, 5), -999)

# @patch.object(process_events.FindMostProbableValueInSpectrum, 'find_mpv')
def test__process_pulseintegrals(self):
self.proc.limit = 1
# mock_find_mpv.return_value = (-999, False)
# Because of small data sample fit fails for detector 1
self.assertEqual(self.proc._process_pulseintegrals()[0][1], -999.)
self.assertAlmostEqual(self.proc._process_pulseintegrals()[0][3], 3.98951741969)
Expand All @@ -74,6 +79,7 @@ def get_testdata_path(self):

class ProcessIndexedEventsTests(ProcessEventsTests):
def setUp(self):
warnings.filterwarnings('ignore')
self.data_path = self.create_tempfile_from_testdata()
self.data = tables.open_file(self.data_path, 'a')
self.proc = process_events.ProcessIndexedEvents(self.data, DATA_GROUP, [0, 10], progress=False)
Expand All @@ -89,6 +95,7 @@ def test_get_traces_for_indexed_event_index(self):

class ProcessEventsWithLINTTests(ProcessEventsTests):
def setUp(self):
warnings.filterwarnings('ignore')
self.data_path = self.create_tempfile_from_testdata()
self.data = tables.open_file(self.data_path, 'a')
self.proc = process_events.ProcessEventsWithLINT(self.data, DATA_GROUP, progress=False)
Expand All @@ -109,6 +116,7 @@ def test__reconstruct_time_from_trace(self):

class ProcessEventsWithTriggerOffsetTests(ProcessEventsTests):
def setUp(self):
warnings.filterwarnings('ignore')
self.data_path = self.create_tempfile_from_testdata()
self.data = tables.open_file(self.data_path, 'a')
self.proc = process_events.ProcessEventsWithTriggerOffset(self.data, DATA_GROUP, progress=False)
Expand Down

0 comments on commit 3fd4d33

Please sign in to comment.