Catch and Address Warnings in test_svg and pytest.ini
On Windows, pyreadline is emitting a deprecation warning we can ignore. Furthermore, test_svg was using NamedTemporaryFile in a manner that was causing permission denied errors, so this commit switches to the use of pytest friendly temporary files
This commit is contained in:
parent
d859cec95a
commit
d72be799d7
@ -19,3 +19,5 @@ filterwarnings =
|
|||||||
ignore:Visible window deleted. To prevent this, store a reference to the window object.
|
ignore:Visible window deleted. To prevent this, store a reference to the window object.
|
||||||
# xvfb warnings on non-linux systems
|
# xvfb warnings on non-linux systems
|
||||||
ignore:Unknown config option:pytest.PytestConfigWarning
|
ignore:Unknown config option:pytest.PytestConfigWarning
|
||||||
|
# pyreadline windows warning
|
||||||
|
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working:DeprecationWarning:pyreadline:8
|
||||||
|
@ -1,18 +1,10 @@
|
|||||||
"""
|
|
||||||
SVG export test
|
|
||||||
"""
|
|
||||||
from __future__ import division, print_function, absolute_import
|
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
import tempfile
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
app = pg.mkQApp()
|
app = pg.mkQApp()
|
||||||
|
|
||||||
|
|
||||||
def test_plotscene():
|
def test_plotscene(tmpdir):
|
||||||
tempfilename = tempfile.NamedTemporaryFile(suffix='.svg').name
|
|
||||||
print("using %s as a temporary file" % tempfilename)
|
|
||||||
pg.setConfigOption('foreground', (0,0,0))
|
pg.setConfigOption('foreground', (0,0,0))
|
||||||
w = pg.GraphicsLayoutWidget()
|
w = pg.GraphicsLayoutWidget()
|
||||||
w.show()
|
w.show()
|
||||||
@ -25,15 +17,13 @@ def test_plotscene():
|
|||||||
app.processEvents()
|
app.processEvents()
|
||||||
|
|
||||||
ex = pg.exporters.SVGExporter(w.scene())
|
ex = pg.exporters.SVGExporter(w.scene())
|
||||||
ex.export(fileName=tempfilename)
|
|
||||||
|
tf = tmpdir.join("expot.svg")
|
||||||
|
ex.export(fileName=tf)
|
||||||
# clean up after the test is done
|
# clean up after the test is done
|
||||||
os.unlink(tempfilename)
|
|
||||||
w.close()
|
w.close()
|
||||||
|
|
||||||
def test_simple():
|
def test_simple(tmpdir):
|
||||||
tempfilename = tempfile.NamedTemporaryFile(suffix='.svg').name
|
|
||||||
print("using %s as a temporary file" % tempfilename)
|
|
||||||
|
|
||||||
view = pg.GraphicsView()
|
view = pg.GraphicsView()
|
||||||
view.show()
|
view.show()
|
||||||
|
|
||||||
@ -78,5 +68,5 @@ def test_simple():
|
|||||||
grp2.addItem(rect3)
|
grp2.addItem(rect3)
|
||||||
|
|
||||||
ex = pg.exporters.SVGExporter(scene)
|
ex = pg.exporters.SVGExporter(scene)
|
||||||
ex.export(fileName=tempfilename)
|
tf = tmpdir.join("expot.svg")
|
||||||
os.unlink(tempfilename)
|
ex.export(fileName=tf)
|
||||||
|
Loading…
Reference in New Issue
Block a user