Skip to content

Commit

Permalink
Explicitly cast alert data to a list in tests
Browse files Browse the repository at this point in the history
In lsst/alert_packet#21, we would like to
change lsst.alert.packet's behavior to stream alerts out from disk
rather than loading them entirely into memory, since alert files might
be very large. Technically, this breaks no APIs, since the documented
return value is an "iterable."

Making that change requires this one: change the test code so that it
loads data into a list explicitly.
  • Loading branch information
spenczar committed Jul 9, 2020
1 parent 87898ef commit f7517bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/test_packageAlerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,9 @@ def testRun(self):

ccdVisitId = self.exposure.getInfo().getVisitInfo().getExposureId()
with open(os.path.join(tempdir, f"{ccdVisitId}.avro"), 'rb') as f:
writer_schema, data = \
writer_schema, data_stream = \
packageAlerts.alertSchema.retrieve_alerts(f)
data = list(data_stream)
self.assertEqual(len(data), len(self.diaSources))
for idx, alert in enumerate(data):
for key, value in alert["diaSource"].items():
Expand Down

0 comments on commit f7517bc

Please sign in to comment.