Skip to content

Commit 4b15675

Browse files
committedApr 26, 2023
Ensure file is closed
1 parent c8ae430 commit 4b15675

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎tests/src/python/test_qgsannotation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def testHtmlAnnotationSetHtmlSource(self):
135135
a.markerSymbol().symbolLayer(0).setStrokeColor(QColor(0, 0, 0))
136136
a.setFrameSizeMm(QSizeF(400 / 3.7795275, 250 / 3.7795275))
137137
a.setFrameOffsetFromReferencePointMm(QPointF(70 / 3.7795275, 90 / 3.7795275))
138-
htmlFile = open(TEST_DATA_DIR + "/test_html.html")
139-
htmlText = htmlFile.read()
138+
with open(TEST_DATA_DIR + "/test_html.html") as f:
139+
htmlText = f.read()
140140
a.setHtmlSource(htmlText)
141141
im = self.renderAnnotation(a, QPointF(20, 30))
142142
self.assertTrue(self.imageCheck('html_annotation_html_source', 'html_annotation', im))

0 commit comments

Comments
 (0)
Please sign in to comment.