Commits

David Mehringer authored 42ef01a3d1f
bug fix, always shutdown server even if exception
No tags

casatasks/tests/tasks/test_task_calmod.py

Modified
102 102
103 103
104 104 def query_server(self, method):
105 105 server = http.server.ThreadingHTTPServer(
106 106 ('127.0.0.1', 8080), MockHTTPRequestHandler
107 107 )
108 108 with server:
109 109 server_thread = threading.Thread(target=server.serve_forever)
110 110 server_thread.daemon = True
111 111 server_thread.start()
112 - method()
113 - server.shutdown()
112 + try:
113 + method()
114 + finally:
115 + server.shutdown()
114 116
115 117
116 118 def test_inputs(self):
117 119 """Test inputs meet various constraints"""
118 120 with self.assertRaises(ValueError) as cm:
119 121 calmod()
120 122 self.exception_verification(cm, 'outfile must be specified')
121 123 with self.assertRaises(ValueError) as cm:
122 124 calmod('my.cl')
123 125 self.exception_verification(cm, 'Exactly one of source or direction must be specified')

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

Add shortcut