Commits

Akeem Wells authored 92ba1d67589
Remove Force Failing Tests used for Bamboo testing.

Set traceback to short by default

casatasks/tests/tasks/test_asdmsummary_fail.py

Deleted
1 -
2 -# Trivial tests of asdmsummary.
3 -# Tests that asdmsummary works without dying on a few ASDMs from
4 -# different telescopes. Also checks that the number of new log rows written
5 -# by asdmsummary matches the expected number for that ASDM.
6 -
7 -from __future__ import absolute_import
8 -import os
9 -import sys
10 -
11 -from casatasks.private.casa_transition import is_CASA6
12 -if is_CASA6:
13 - from casatools import ctsys
14 - from casatasks import asdmsummary, casalog
15 -
16 -else:
17 - from __main__ import default
18 - from tasks import asdmsummary
19 - from taskinit import casalog
20 -
21 -import unittest
22 -
23 -def logfileLen():
24 - # count the lines in the current log file
25 - result = 0
26 - logfile = casalog.logfile()
27 - if os.path.isfile(logfile):
28 - with open(logfile) as f:
29 - for result, l in enumerate(f,1):
30 - pass
31 - return result
32 -
33 -def taskLogRange(startat):
34 - # return the start and end line numbers in the current logfile for "asdmsummary" task start and end after startat line
35 - # task start is a line with "Begin Task" and "asdmsummary" in it
36 - # task end is a line with "End Task" and "asdmsummary" in it
37 - # the first line matching each is returned
38 - # each value is -1 if no matching line is found
39 - # the end line isn't checked unless a start line has already been found
40 - firstLine = -1
41 - lastLine = -1
42 - logfile = casalog.logfile()
43 - if os.path.isfile(logfile):
44 - with open(logfile) as f:
45 - # lineNum will be the number of lines read, l is the most recent line read
46 - for lineNum, l in enumerate(f,1):
47 - # nothing happens until at startat line
48 - if lineNum >= startat:
49 - if firstLine < 0:
50 - if ((l.find('Begin Task') >= 0) and (l.find('asdmsummary')>=0)):
51 - firstLine = lineNum
52 - else:
53 - if ((l.find('End Task') >= 0) and (l.find('asdmsummary')>=0)):
54 - lastLine = lineNum
55 - break
56 - return (firstLine,lastLine)
57 -
58 -class asdmsummary_test(unittest.TestCase):
59 -
60 - # trivial tests that just demonstrate it doesn't fail completely
61 - # also now counts the number of lines written to the log file against expected count
62 -
63 - # CASA5 needs to know where the data is
64 - # CASA5 spits out 8 additional lines to the log that CASA6 does not produce
65 - dataPath = ""
66 - extraLines = 0
67 - if is_CASA6:
68 - dataPath = ctsys.resolve('unittest/asdmsummary/')
69 - else:
70 - dataPath = os.path.join(os.environ.get('CASAPATH').split()[0],'/casatestdata/unittest/asdmsummary/')
71 - extraLines = 8
72 -
73 - def doASDMSummary(self, asdmpath, expectedLogLines):
74 - # run asdmsummary, expepctedLogLines is the expected number of new log lines
75 - logLength = logfileLen()
76 - asdmsummary(os.path.join(self.dataPath,asdmpath))
77 - (firstLine,lastLine) = taskLogRange(logLength)
78 - newLines = 0
79 - if (firstLine >= 0) and (lastLine >= 0):
80 - newLines = lastLine-firstLine+1
81 - #self.assertEqual(newLines,expectedLogLines+self.extraLines)
82 - self.assertTrue(False)
83 -
84 - def setUp(self):
85 - if is_CASA6:
86 - pass
87 - else:
88 - default(asdmsummary)
89 -
90 - def tearDown(self):
91 - pass
92 -
93 - def test_alma_asdm(self):
94 - ''' ALMA M51 data'''
95 - # used in test_importasdm, test_importasdm_mms.
96 - nlines = 170
97 - self.doASDMSummary('uid___X5f_X18951_X1', nlines)
98 -
99 - def test_vla_asdm(self):
100 - '''VLA data'''
101 - # used in test_importevla, test_importasdm_mms, test_importasdm
102 - nlines = 250
103 - self.doASDMSummary('X_osro_013.55979.93803716435',nlines)
104 -
105 - def test_aca_asdm(self):
106 - '''ACA with mixed pol/channelisation'''
107 - # used in test_importasdm_mms, test_importasdm
108 - nlines = 2517
109 - self.doASDMSummary('uid___A002_X72bc38_X000',nlines)
110 -
111 - def test_12m_asdm(self):
112 - ''' 12m with mixedl pol/channelisation'''
113 - # used in test_importasdm_mms, test_importasdm
114 - nlines = 1021
115 - self.doASDMSummary('uid___A002_X71e4ae_X317_short',nlines)
116 -
117 -def suite():
118 - return [asdmsummary_test]
119 -
120 -if is_CASA6:
121 - if __name__ == '__main__':
122 - unittest.main()

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut