Closed lpsinger closed 5 years ago
The last update of gwemopt (to 0.0.53) broke the unit tests. Here are the test failures:
___________________________ test_grb180116a_fin_pos ____________________________ mock_call_everyone = <MagicMock name='run' id='140157193941568'> mock_contour = <MagicMock name='run' id='140157193944816'>, celery = None flask = <FlaskClient <Flask 'growth.too.flask'>>, mail = None @mock.patch('growth.too.tasks.skymaps.contour.run') @mock.patch('growth.too.tasks.twilio.call_everyone.run') @mock.patch('astropy.io.fits.file.download_file', mock_download_file) def test_grb180116a_fin_pos(mock_call_everyone, mock_contour, celery, flask, mail): # Read test GCN payload = pkg_resources.resource_string( __name__, 'data/GRB180116A_Fermi_GBM_Fin_Pos.xml') root = lxml.etree.fromstring(payload) # Run function under test handle(payload, root) dateobs = '2018-01-16T00:36:53' event = models.Event.query.get(dateobs) assert event is not None *_, gcn_notice = event.gcn_notices assert gcn_notice.content == payload assert gcn_notice.notice_type == gcn.NoticeType.FERMI_GBM_FIN_POS assert time.Time(gcn_notice.date) == time.Time('2018-01-16T00:46:05') assert gcn_notice.ivorn == 'ivo://nasa.gsfc.gcn/Fermi#GBM_Fin_Pos2018-01-16T00:36:52.81_537755817_0-026' # noqa: E501 assert gcn_notice.stream == 'Fermi' assert time.Time(gcn_notice.dateobs) - time.Time(dateobs) < 0.5 * u.second assert event.tags == ['Fermi', 'long', 'GRB'] mock_call_everyone.assert_not_called() localization, = event.localizations assert np.isclose(localization.flat_2d.sum(), 1.0) telescope = 'ZTF' filt = ['g', 'r', 'g'] exposuretimes = [300.0, 300.0, 300.0] doReferences, doDither = True, False filterScheduleType = 'block' schedule_type = 'greedy' probability = 0.9 plan_name = "%s_%s_%d_%d_%s_%d_%d" % ("".join(filt), schedule_type, doDither, doReferences, filterScheduleType, exposuretimes[0], 100*probability) plan = models.Plan.query.filter_by(plan_name=plan_name, telescope=telescope).one() assert time.Time(plan.dateobs) - time.Time(dateobs) < 0.5 * u.second exposures = models.PlannedObservation.query.filter_by( dateobs=event.dateobs, telescope=telescope, plan_name=plan.plan_name).all() for exposure in exposures: field_id = exposure.field_id assert np.all(np.array(field_id) < 907) assert np.all(np.array(exposure.exposure_time) > 0) assert np.all(np.array(exposure.weight) <= 1) > assert np.isclose(plan.area, 790.3129926351713) E assert False E + where False = <function isclose at 0x7f791f668730>(651.6459456904389, 790.3129926351713) E + where <function isclose at 0x7f791f668730> = np.isclose E + and 651.6459456904389 = <Plan 2018-01-16 00:36:53, ZTF, grg_greedy_0_1_block_300_90>.area growth/too/tests/test_gcn.py:94: AssertionError ----------------------------- Captured stdout call ----------------------------- natural_nside = 512 nside = 512 Generating segments for tiles... Generating powerlaw schedule... Generating schedule order... Generating schedule order... Generating schedule order... natural_nside = 512 nside = 512 Generating segments for tiles... Generating powerlaw schedule... Generating schedule order... natural_nside = 512 nside = 512 Generating segments for tiles... Generating powerlaw schedule... Generating schedule order... natural_nside = 512 nside = 512 Generating segments for tiles... Generating powerlaw schedule... Generating schedule order... natural_nside = 512 nside = 512 Generating segments for tiles... Generating powerlaw schedule... Generating schedule order... ----------------------------- Captured stderr call ----------------------------- INFO:celery.app.trace:Task growth.too.tasks.skymaps.download[3a179c82-966f-4e49-893b-3608736fa98a] succeeded in 3.3851198370000475s: 'glg_healpix_all_bn180116026.fit' INFO:growth.too.tasks.tiles:Loading skymap INFO:growth.too.tasks.tiles:Generating MOC struct INFO:celery.app.trace:Task growth.too.tasks.tiles.tile[7e2da5bc-d7f6-4c2d-b4ee-da60684a01a0] succeeded in 93.77714825700002s: None INFO:growth.too.tasks.tiles:Loading skymap INFO:growth.too.tasks.tiles:Generating MOC struct INFO:celery.app.trace:Task growth.too.tasks.tiles.tile[c40a9135-46db-4922-b88a-8b662fda5510] succeeded in 33.78141899399998s: None INFO:growth.too.tasks.tiles:Loading skymap INFO:growth.too.tasks.tiles:Generating MOC struct INFO:celery.app.trace:Task growth.too.tasks.tiles.tile[12247c99-24a7-4c38-a554-6087206fafd2] succeeded in 357.52641255900005s: None INFO:growth.too.tasks.tiles:Loading skymap INFO:growth.too.tasks.tiles:Generating catalog... INFO:growth.too.tasks.tiles:Generating galaxy struct... INFO:celery.app.trace:Task growth.too.tasks.tiles.tile[744abbbd-dd83-4976-9a6d-424c7792a39d] succeeded in 13.604977830000053s: None INFO:growth.too.tasks.tiles:Loading skymap INFO:growth.too.tasks.tiles:Generating catalog... INFO:growth.too.tasks.tiles:Generating galaxy struct... INFO:celery.app.trace:Task growth.too.tasks.tiles.tile[3ab57fa4-0a43-4624-b8ea-9d3e76a6ad10] succeeded in 13.599001122000118s: None INFO:celery.app.trace:Task growth.too.tasks.skymaps.contour[bb0f16c9-2788-4eda-a651-3afdd9b08a11] succeeded in 0.0007146009997995861s: <MagicMock name='run()' id='140156835638576'> ------------------------------ Captured log call ------------------------------- trace.py 124 INFO Task growth.too.tasks.skymaps.download[3a179c82-966f-4e49-893b-3608736fa98a] succeeded in 3.3851198370000475s: 'glg_healpix_all_bn180116026.fit' tiles.py 212 INFO Loading skymap tiles.py 223 INFO Generating MOC struct trace.py 124 INFO Task growth.too.tasks.tiles.tile[7e2da5bc-d7f6-4c2d-b4ee-da60684a01a0] succeeded in 93.77714825700002s: None tiles.py 212 INFO Loading skymap tiles.py 223 INFO Generating MOC struct trace.py 124 INFO Task growth.too.tasks.tiles.tile[c40a9135-46db-4922-b88a-8b662fda5510] succeeded in 33.78141899399998s: None tiles.py 212 INFO Loading skymap tiles.py 223 INFO Generating MOC struct trace.py 124 INFO Task growth.too.tasks.tiles.tile[12247c99-24a7-4c38-a554-6087206fafd2] succeeded in 357.52641255900005s: None tiles.py 212 INFO Loading skymap tiles.py 218 INFO Generating catalog... tiles.py 238 INFO Generating galaxy struct... trace.py 124 INFO Task growth.too.tasks.tiles.tile[744abbbd-dd83-4976-9a6d-424c7792a39d] succeeded in 13.604977830000053s: None tiles.py 212 INFO Loading skymap tiles.py 218 INFO Generating catalog... tiles.py 238 INFO Generating galaxy struct... trace.py 124 INFO Task growth.too.tasks.tiles.tile[3ab57fa4-0a43-4624-b8ea-9d3e76a6ad10] succeeded in 13.599001122000118s: None trace.py 124 INFO Task growth.too.tasks.skymaps.contour[bb0f16c9-2788-4eda-a651-3afdd9b08a11] succeeded in 0.0007146009997995861s: <MagicMock name='run()' id='140156835638576'>
This was fixed on Friday.
The last update of gwemopt (to 0.0.53) broke the unit tests. Here are the test failures: