From 13637491320664c0e00c5bab919b71a01634ab47 Mon Sep 17 00:00:00 2001 From: Vincent Roseberry Date: Fri, 7 May 2021 17:14:48 +0000 Subject: [PATCH] Fix warning in openslide test ``` ResourceWarning: unclosed file <_io.BufferedReader name='/input/tests/data/test.tif'> testMethod() ResourceWarning: Enable tracemalloc to get the object allocation traceback ``` --- tests/test_openslide.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_openslide.py b/tests/test_openslide.py index 6524ef40..f0d7c5b5 100644 --- a/tests/test_openslide.py +++ b/tests/test_openslide.py @@ -4,6 +4,5 @@ class TestOpenslide(unittest.TestCase): def test_read_tif(self): - slide = open_slide('/input/tests/data/test.tif') - - self.assertEqual(1, slide.level_count) + with open_slide('/input/tests/data/test.tif') as slide: + self.assertEqual(1, slide.level_count)