Skip to content

Commit

Permalink
close images and remove temporary files
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed May 14, 2018
1 parent 1d6e238 commit c90134d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/widgets/_base_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def setUp(self):
def tearDown(self):
import matplotlib.pyplot as plt
if hasattr(self, 'straditizer_widgets'):
if self.straditizer_widgets.straditizer is not None:
self.straditizer.image.close()
if self.straditizer.data_reader is not None:
self.reader.image.close()
self.straditizer_widgets.straditizer = None
self.straditizer_widgets.refresh()
if not running_in_gui:
Expand Down Expand Up @@ -261,7 +265,8 @@ def assertArrayEquals(self, arr, ref):

def get_random_filename(self, **kwargs):
kwargs.setdefault('prefix', 'stradi_')
fname = tempfile.NamedTemporaryFile(**kwargs).name
with tempfile.NamedTemporaryFile(**kwargs) as file:
fname = file.name
self.created_files.add(fname)
return fname

Expand Down

0 comments on commit c90134d

Please sign in to comment.