Permalink
Browse files

more cleaning

  • Loading branch information...
sdpython committed Jan 21, 2018
1 parent 633648e commit e50f3b3c195f4dde1bbe0e433007a2f063becef9
@@ -68,7 +68,7 @@ def test_video_audio_bug(self):
exp = os.path.join(temp, "courte2x.mp4")
video_save(vid4, exp)
self.assertExists(exp)
clean_video([vid4, vid2, vid3])
clean_video([vid4, vid2, vid3, audio, audio1, audio3])
if __name__ == "__main__":
@@ -80,7 +80,7 @@ def test_video_image_position(self):
vid = video_position(img, lambda t: (t * 0.1, t * 0.2), relative=True)
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video(vid)
clean_video([vid, img])
def test_video_image_resize(self):
fLOG(
@@ -105,7 +105,7 @@ def test_video_image_resize(self):
vid = video_resize(img, lambda t: max(0.1, 1 - 0.1 * t))
video_save(vid, exp, fps=20)
self.assertExists(exp)
clean_video(vid)
clean_video([vid, img])
if __name__ == "__main__":
@@ -156,8 +156,11 @@ def clean_video(video):
else:
if not hasattr(video, 'close'):
if hasattr(video, 'reader') and video.reader:
video.reader.close()
video.reader = None
try:
video.reader.close()
video.reader = None
except AttributeError:
pass
try:
if video.audio:
video.audio.close()

0 comments on commit e50f3b3

Please sign in to comment.