I agree with Jim that these commits should be squashed before merging.
What should the failure mode be if testDM384.fits already exists? Will catalog.writeFits() clobber it, or will the test fail? If the former, is that desired behaviour?
If the test fails for another reason, do you want to clean up testDM384.fits or leave it lying around for forensics?
I'm not sure if this is within the scope of this review, but: structurally, this looks more like three tests than one to me. That's ugly, and there's a lot of repeated code. You could consider restructuring things to avoid the repetition and make the cleanup automatic. Something like:
class TestDM384(unittest.TestCase):
|
def setUp(self):
|
self.filename = "testDM384.fits"
|
self.schema = lsst.afw.table.Schema()
|
self.schema.setVersion(5)
|
self.schema.addField("f1", doc="f1a", type="I")
|
self.schema.addField("f2", doc="f2a", type="Flag")
|
self.schema.addField("f3", doc="f3a", type="ArrayF", size=4)
|
|
def tearDown(self):
|
os.unlink(self.filename)
|
|
def _run_test(self, catalog):
|
self.assertEqual(catalog.getTable().getVersion(), 5)
|
catalog.writeFits(self.filename)
|
# now read the table just written to disk, and see if it reads back correctly
|
catalog = catalog.readFits(self.filename)
|
metadata = catalog.getTable().getMetadata()
|
self.assertEqual(catalog.schema.getVersion(), 5)
|
self.assertFalse(metadata == None)
|
self.assertFalse(metadata.exists("AFW_TABLE_VERSION"))
|
|
def test_BaseCatalog(self):
|
self._run_test(BaseCatalog(self.schema))
|
|
def test_SimpleCatalog(self):
|
self._run_test(SimpleCatalog(self.schema))
|
|
def test_SourceCatalog(self):
|
self._run_test(SourceCatalog(self.schema))
|
(I've not actually tested the above, so it's probably riddled with typos etc, and I'm not sure if there's a substantive difference between lsst.afw.table.SimpleTable.makeMinimalSchema and lsst.afw.table.Schema, but you get the gist.)
This goes significantly beyond the immediate scope of this issue, though, so I don't think it has to be done before this is merged. (Indeed, I'm not even sure if I'm allowed to request it here, or if I should open a new issue...)
git blame reveals that this is your doing. Could you fix it?