Skip to content

Commit

Permalink
Merge pull request #90 from lsst/tickets/DM-14612
Browse files Browse the repository at this point in the history
DM-14612 Fix possible race condition on file delete
  • Loading branch information
parejkoj committed May 30, 2018
2 parents dcb55a6 + 45987d6 commit 03249af
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tests/test_jointcal_cfht_minimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import inspect
import unittest
import os
import contextlib

import lsst.afw.geom
import lsst.utils
Expand Down Expand Up @@ -45,14 +44,6 @@ def setUp(self):
other_args=other_args,
do_plot=do_plot, log_level="debug")

def tearDown(self):
super()
with contextlib.suppress(FileNotFoundError):
os.remove("photometry_preinit-mat.txt")
os.remove("photometry_preinit-grad.txt")
os.remove("photometry_postinit-mat.txt")
os.remove("photometry_postinit-grad.txt")

def test_jointcalTask_2_visits_photometry(self):
self.config = lsst.jointcal.jointcal.JointcalConfig()
self.config.photometryRefObjLoader.retarget(LoadAstrometryNetObjectsTask)
Expand All @@ -77,9 +68,13 @@ def test_jointcalTask_2_visits_photometry(self):

# Check that the Hessian/gradient files were written.
self.assertTrue(os.path.exists("photometry_preinit-mat.txt"))
os.remove("photometry_preinit-mat.txt")
self.assertTrue(os.path.exists("photometry_preinit-grad.txt"))
os.remove("photometry_preinit-grad.txt")
self.assertTrue(os.path.exists("photometry_postinit-mat.txt"))
os.remove("photometry_postinit-mat.txt")
self.assertTrue(os.path.exists("photometry_postinit-grad.txt"))
os.remove("photometry_postinit-grad.txt")

def test_jointcalTask_fails_raise(self):
"""Raise an exception if there is no data to process."""
Expand Down

0 comments on commit 03249af

Please sign in to comment.