Fixed bug in unit test where temp file remained open when os.unlink was called (#832)

This commit is contained in:
HappyTreeBeard 2019-05-23 21:33:23 -07:00 committed by Ogi Moore
parent 20c74954a5
commit 8420fe984a

View File

@ -1,5 +1,5 @@
"""
SVG export test
CSV export test
"""
from __future__ import division, print_function, absolute_import
import pyqtgraph as pg
@ -33,8 +33,9 @@ def test_CSVExporter():
ex = pg.exporters.CSVExporter(plt.plotItem)
ex.export(fileName=tempfilename)
r = csv.reader(open(tempfilename, 'r'))
lines = [line for line in r]
with open(tempfilename, 'r') as csv_file:
r = csv.reader(csv_file)
lines = [line for line in r]
header = lines.pop(0)
assert header == ['myPlot_x', 'myPlot_y', 'x0001', 'y0001', 'x0002', 'y0002']