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