Close windows at the end of test functions (#1042)
* Close windows at the end of test functions * Can't show window deletion warning during interpreter shutdown starting
This commit is contained in:
parent
071e429535
commit
61ec73a741
@ -28,6 +28,7 @@ def test_plotscene():
|
|||||||
ex.export(fileName=tempfilename)
|
ex.export(fileName=tempfilename)
|
||||||
# clean up after the test is done
|
# clean up after the test is done
|
||||||
os.unlink(tempfilename)
|
os.unlink(tempfilename)
|
||||||
|
w.close()
|
||||||
|
|
||||||
def test_simple():
|
def test_simple():
|
||||||
tempfilename = tempfile.NamedTemporaryFile(suffix='.svg').name
|
tempfilename = tempfile.NamedTemporaryFile(suffix='.svg').name
|
||||||
|
@ -71,6 +71,8 @@ def test_ViewBox():
|
|||||||
size1 = QRectF(0, h, w, -h)
|
size1 = QRectF(0, h, w, -h)
|
||||||
assertMapping(vb, view1, size1)
|
assertMapping(vb, view1, size1)
|
||||||
|
|
||||||
|
win.close()
|
||||||
|
|
||||||
|
|
||||||
skipreason = "Skipping this test until someone has time to fix it."
|
skipreason = "Skipping this test until someone has time to fix it."
|
||||||
@pytest.mark.skipif(True, reason=skipreason)
|
@pytest.mark.skipif(True, reason=skipreason)
|
||||||
|
@ -28,3 +28,5 @@ def test_AxisItem_stopAxisAtTick(monkeypatch):
|
|||||||
monkeypatch.setattr(left, "drawPicture", test_left)
|
monkeypatch.setattr(left, "drawPicture", test_left)
|
||||||
|
|
||||||
plot.show()
|
plot.show()
|
||||||
|
app.processEvents()
|
||||||
|
plot.close()
|
||||||
|
@ -35,3 +35,5 @@ def test_ErrorBarItem_defer_data():
|
|||||||
r_clear_ebi = plot.viewRect()
|
r_clear_ebi = plot.viewRect()
|
||||||
|
|
||||||
assert r_clear_ebi == r_no_ebi
|
assert r_clear_ebi == r_no_ebi
|
||||||
|
|
||||||
|
plot.close()
|
||||||
|
@ -28,6 +28,7 @@ def test_PlotCurveItem():
|
|||||||
c.setData(data, connect=np.array([1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0]))
|
c.setData(data, connect=np.array([1,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0]))
|
||||||
assertImageApproved(p, 'plotcurveitem/connectarray', "Plot curve with connection array.")
|
assertImageApproved(p, 'plotcurveitem/connectarray', "Plot curve with connection array.")
|
||||||
|
|
||||||
|
p.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -86,3 +86,5 @@ def test_clipping():
|
|||||||
|
|
||||||
assert xDisp[0] <= vr.left()
|
assert xDisp[0] <= vr.left()
|
||||||
assert xDisp[-1] >= vr.right()
|
assert xDisp[-1] >= vr.right()
|
||||||
|
|
||||||
|
w.close()
|
||||||
|
@ -411,7 +411,11 @@ class GraphicsView(QtGui.QGraphicsView):
|
|||||||
try:
|
try:
|
||||||
if self.parentWidget() is None and self.isVisible():
|
if self.parentWidget() is None and self.isVisible():
|
||||||
msg = "Visible window deleted. To prevent this, store a reference to the window object."
|
msg = "Visible window deleted. To prevent this, store a reference to the window object."
|
||||||
|
try:
|
||||||
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
||||||
|
except TypeError:
|
||||||
|
# warnings module not available during interpreter shutdown
|
||||||
|
pass
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user