-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Short description
Encountered an AssertionError in test_makeARGB.py and test_ROI.py while testing on a RISC-V architecture.
Code to reproduce
git clone https://github.com/pyqtgraph/pyqtgraph.gitthencd pyqtgraph- Run python3 test.py
- Test Failed
Expected behavior
The tests should pass without any assertion errors.
Real behavior
The test fails with the following information:
<mock-chroot> sh-5.2# python3 test.py
sys.platform: linux
sys.version: 3.12.0 (main, Oct 5 2023, 00:00:00) [GCC 13.2.1 20231110 (Red Hat 13.2.1-5)]
qt bindings: PyQt5 5.15.10 Qt 5.15.11
pyqtgraph: 0.13.5.dev0; None
config:
{'antialias': False,
'background': 'k',
'crashWarning': False,
'editorCommand': None,
'enableExperimental': False,
'exitCleanup': True,
'foreground': 'd',
'imageAxisOrder': 'col-major',
'leftButtonPan': True,
'mouseRateLimit': 100,
'segmentedLineMode': 'auto',
'useCupy': False,
'useNumba': False,
'useOpenGL': False}
============================================== test session starts ===============================================
platform linux -- Python 3.12.0, pytest-7.4.3, pluggy-1.3.0
rootdir: /builddir/pyqtgraph
configfile: pytest.ini
plugins: xvfb-2.0.0
collected 457 items / 2 skipped
pyqtgraph/examples/test_examples.py ....................................s................................. [ 15%]
.s.s......................... [ 21%]
tests/test_Point.py ................. [ 25%]
tests/test_Vector.py .. [ 25%]
tests/test_canvas_manager_crash.py . [ 26%]
tests/test_colormap.py ...... [ 27%]
tests/test_configparser.py .. [ 27%]
tests/test_functions.py .................................................................................. [ 45%]
.......................................... [ 54%]
tests/test_makeARGB.py Fss. [ 55%]
tests/test_pickles.py .. [ 56%]
tests/test_qimage_writethru.py . [ 56%]
tests/test_qmenu_leak_workaround.py . [ 56%]
tests/test_qpainterpathprivate.py .. [ 57%]
tests/test_qt.py .. [ 57%]
tests/test_ref_cycles.py .. [ 57%]
tests/test_reload.py . [ 58%]
tests/test_signalproxy.py .... [ 59%]
tests/test_srttransform3d.py . [ 59%]
tests/test_stability.py . [ 59%]
tests/dockarea/test_dock.py .... [ 60%]
tests/dockarea/test_dockarea.py . [ 60%]
tests/exporters/test_csv.py .. [ 61%]
tests/exporters/test_exporter_dialog.py . [ 61%]
tests/exporters/test_hdf5.py ... [ 61%]
tests/exporters/test_image.py .. [ 62%]
tests/exporters/test_svg.py .. [ 62%]
tests/graphicsItems/test_ArrowItem.py . [ 63%]
tests/graphicsItems/test_AxisItem.py .............. [ 66%]
tests/graphicsItems/test_ErrorBarItem.py . [ 66%]
tests/graphicsItems/test_GraphicsItem.py .. [ 66%]
tests/graphicsItems/test_ImageItem.py ss.... [ 68%]
tests/graphicsItems/test_ImageItemFormat.py ... [ 68%]
tests/graphicsItems/test_InfiniteLine.py .. [ 69%]
tests/graphicsItems/test_LegendItem.py . [ 69%]
tests/graphicsItems/test_LinearRegionItem.py ..... [ 70%]
tests/graphicsItems/test_NonUniformImage.py ..... [ 71%]
tests/graphicsItems/test_PlotCurveItem.py .. [ 71%]
tests/graphicsItems/test_PlotDataItem.py ......... [ 73%]
tests/graphicsItems/test_ROI.py ....F.... [ 75%]
tests/graphicsItems/test_ScatterPlotItem.py .. [ 76%]
tests/graphicsItems/test_TextItem.py . [ 76%]
tests/graphicsItems/PlotItem/test_PlotItem.py ....................... [ 81%]
tests/graphicsItems/ViewBox/test_ViewBox.py ..s [ 82%]
tests/graphicsItems/ViewBox/test_ViewBoxZoom.py ........ [ 84%]
tests/imageview/test_imageview.py ... [ 84%]
tests/opengl/items/test_GLAxisItem.py . [ 84%]
tests/opengl/items/test_GLBarGraphItem.py . [ 85%]
tests/opengl/items/test_GLBoxItem.py . [ 85%]
tests/opengl/items/test_GLGradientLegendItem.py . [ 85%]
tests/opengl/items/test_GLGraphItem.py . [ 85%]
tests/opengl/items/test_GLGridItem.py . [ 85%]
tests/opengl/items/test_GLImageItem.py . [ 86%]
tests/opengl/items/test_GLLinePlotItem.py . [ 86%]
tests/opengl/items/test_GLMeshItem.py . [ 86%]
tests/opengl/items/test_GLScatterPlotItem.py . [ 86%]
tests/opengl/items/test_GLSurfacePlotItem.py . [ 87%]
tests/opengl/items/test_GLTextItem.py . [ 87%]
tests/opengl/items/test_GLVolumeItem.py . [ 87%]
tests/parametertree/test_Parameter.py ...................... [ 92%]
tests/parametertree/test_parametertypes.py ........ [ 94%]
tests/widgets/test_busycursor.py . [ 94%]
tests/widgets/test_combobox.py . [ 94%]
tests/widgets/test_graphics_view.py . [ 94%]
tests/widgets/test_histogramlutwidget.py . [ 94%]
tests/widgets/test_progressdialog.py . [ 95%]
tests/widgets/test_spinbox.py ..................... [ 99%]
tests/widgets/test_tablewidget.py . [100%]
==================================================== FAILURES ====================================================
___________________________________ test_makeARGB_against_generated_references ___________________________________
def test_makeARGB_against_generated_references():
def assert_correct(data, key, levels, lut, scale, use_rgba):
expectation = EXPECTED_OUTPUTS[key]
if isinstance(expectation, type) and issubclass(expectation, Exception):
try:
_makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
except Exception as e:
assert expectation == type(e)
else:
assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything."
else:
output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
assert (
output == expectation
).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n Got:\n{output!r}"
> _do_something_for_every_combo(assert_correct)
tests/test_makeARGB.py:4295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_makeARGB.py:4246: in _do_something_for_every_combo
func(data, key, levels, lut, scale, use_rgba)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = array([[ inf, 0.53662884, nan, 0.8853132 ],
[0.8496698 , 0.88006145, 1. , 0.06621328],
...99158293, 0.8476984 , 0.16672458, 0.9887786 ],
[0.07076367, 0.66354364, 0.8781082 , 0.988832 ]], dtype=float32)
key = (<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True), levels = (0, 1), lut = None, scale = None
use_rgba = True
def assert_correct(data, key, levels, lut, scale, use_rgba):
expectation = EXPECTED_OUTPUTS[key]
if isinstance(expectation, type) and issubclass(expectation, Exception):
try:
_makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
except Exception as e:
assert expectation == type(e)
else:
assert False, f"makeARGB({key!r}) was supposed to raise {expectation} but didn't raise anything."
else:
output, alpha = _makeARGB(data, lut=lut, levels=levels, scale=scale, useRGBA=use_rgba)
> assert (
output == expectation
).all(), f"Incorrect _makeARGB({key!r}) output! Expected:\n{expectation!r}\n Got:\n{output!r}"
E AssertionError: Incorrect _makeARGB((<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True)) output! Expected:
E [223, 223, 223, 255],
E [252, 252, 252, 255]]], dtype=uint8)
E Got:
E array([[[255, 255, 255, 255],
E [136, 136, 136, 255],
E [255, 255, 255, 0],
E [225, 225, 225, 255]],
E
E [[216, 216, 216, 255],
E [224, 224, 224, 255],
E [255, 255, 255, 255],
E [ 16, 16, 16, 255]],
E
E [[252, 252, 252, 255],
E [216, 216, 216, 255],
E [ 42, 42, 42, 255],
E [252, 252, 252, 255]],
E
E [[ 18, 18, 18, 255],
E [169, 169, 169, 255],
E [223, 223, 223, 255],
E [252, 252, 252, 255]]], dtype=uint8)
E assert False
E + where False = <built-in method all of numpy.ndarray object at 0x3ef7d09dd0>()
E + where <built-in method all of numpy.ndarray object at 0x3ef7d09dd0> = array([[[255,..., dtype=uint8) == array([[[255,..., dtype=uint8)
E Use -v to get more diff.all
tests/test_makeARGB.py:4291: AssertionError
________________________________________________ test_PolyLineROI ________________________________________________
def test_PolyLineROI():
rois = [
(pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=True, pen=0.3),
'closed'),
(pg.PolyLineROI([[0, 0], [10, 0], [0, 15]], closed=False, pen=0.3),
'open')
]
plt = pg.GraphicsView()
plt.show()
resizeWindow(plt, 200, 200)
vb = pg.ViewBox()
plt.scene().addItem(vb)
vb.resize(200, 200)
# plt.plotItem = pg.PlotItem()
# plt.scene().addItem(plt.plotItem)
# plt.plotItem.resize(200, 200)
plt.scene().minDragTime = 0 # let us simulate mouse drags very quickly.
# seemingly arbitrary requirements; might need longer wait time for some
# platforms..
# hover over center
center = r.mapToScene(pg.Point(3, 3))
mouseMove(plt, center)
assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_roi',
'Hover mouse over center of ROI.')
# drag ROI
mouseDrag(plt, center, center + pg.Point(10, -10),
QtCore.Qt.MouseButton.LeftButton)
assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_roi',
'Drag mouse over center of ROI.')
# hover over handle
pt = r.mapToScene(pg.Point(r.getState()['points'][2]))
mouseMove(plt, pt)
assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_handle',
'Hover mouse over handle.')
# drag handle
mouseDrag(plt, pt, pt + pg.Point(5, 20),
QtCore.Qt.MouseButton.LeftButton)
assertImageApproved(plt, 'roi/polylineroi/' + name + '_drag_handle',
'Drag mouse over handle.')
# hover over segment
pt = r.mapToScene((pg.Point(r.getState()['points'][2]) + pg.Point(
r.getState()['points'][1])) * 0.5)
mouseMove(plt, pt + pg.Point(0, 2))
assertImageApproved(plt, 'roi/polylineroi/' + name + '_hover_segment',
'Hover mouse over diagonal segment.
> assertImageApproved(plt, 'roi/polylineroi/' + name + '_click_segment',
'Click mouse over segment.')
tests/graphicsItems/test_ROI.py:309:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/image_testing.py:150: in assertImageApproved
assertImageMatch(image, stdImage, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
im1 = array([[[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
...,
[ 0, ...,
...,
[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
[ 0, 0, 0, 255]]], dtype=uint8)
im2 = array([[[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
...,
[ 0, ...,
...,
[ 0, 0, 0, 255],
[ 0, 0, 0, 255],
[ 0, 0, 0, 255]]], dtype=uint8)
minCorr = None, pxThreshold = 50.0, pxCount = 0, maxPxDiff = None, avgPxDiff = None, imgDiff = None
def assertImageMatch(im1, im2, minCorr=None, pxThreshold=50.,
pxCount=-1, maxPxDiff=None, avgPxDiff=None,
imgDiff=None):
"""Check that two images match.
Images that differ in shape or dtype will fail unconditionally.
Further tests for similarity depend on the arguments supplied.
By default, images may have no pixels that gave a value difference greater
than 50.
Parameters
----------
im1 : (h, w, 4) ndarray
Test output image
im2 : (h, w, 4) ndarray
Test standard image
minCorr : float or None
Minimum allowed correlation coefficient between corresponding image
values (see numpy.corrcoef)
pxThreshold : float
Minimum value difference at which two pixels are considered different
pxCount : int or None
Maximum number of pixels that may differ. Default is 0, on Windows some
tests have a value of 2.
maxPxDiff : float or None
Maximum allowed difference between pixels
avgPxDiff : float or None
Average allowed difference between pixels
imgDiff : float or None
Maximum allowed summed difference between images
"""
assert im1.ndim == 3
<pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b59490>
bounding rect: PyQt5.QtCore.QRectF(-0.9126637026167694, -0.04409851807728548, 2.110682744292866, 13.376065001798606)
transform:
[1.00 0.00 0.00]
[0.00 1.00 0.00]
[0.00 0.00 1.00]
<pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b59b50>
bounding rect: PyQt5.QtCore.QRectF(0.0, -1.3697056274847716, 10.0, 2.7394112549695433)
transform:
[1.00 0.00 0.00]
[0.00 1.00 0.00]
[0.00 0.00 1.00]
<pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b58a70>
bounding rect: PyQt5.QtCore.QRectF(4.553964306528743, -1.0093820160448754, 6.063284590378109, 8.662698014911768)
transform:
[1.00 0.00 0.00]
[0.00 1.00 0.00]
[0.00 0.00 1.00]
<pyqtgraph.graphicsItems.ROI._PolyLineSegment object at 0x3ef4b6a570>
bounding rect: PyQt5.QtCore.QRectF(-0.327946508818989, 5.629153019466479, 6.1124615601329015, 8.673495909533095)
transform:
[1.00 0.00 0.00]
[0.00 1.00 0.00]
[0.00 0.00 1.00]
<pyqtgraph.graphicsItems.ROI.Handle object at 0x3ef4b58b00>
bounding rect: PyQt5.QtCore.QRectF(-0.20177669529663686, -0.30266504294495655, 0.40355339059327383, 0.605
tests/parametertree/test_parametertypes.py: 2 warnings
/builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/list.py:97: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
Parameter.__init__(self, **opts)
tests/exporters/test_csv.py: 3 warnings
tests/exporters/test_exporter_dialog.py: 1 warning
tests/exporters/test_hdf5.py: 3 warnings
tests/exporters/test_image.py: 2 warnings
tests/exporters/test_svg.py: 2 warnings
tests/parametertree/test_Parameter.py: 15 warnings
tests/parametertree/test_parametertypes.py: 4 warnings
/builddir/pyqtgraph/pyqtgraph/parametertree/Parameter.py:140: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
return cls(**opts)
tests/parametertree/test_parametertypes.py::test_checklist_show_hide
tests/parametertree/test_parametertypes.py::test_recreate_from_savestate
/builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/checklist.py:169: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
super().__init__(**opts)
tests/parametertree/test_parametertypes.py::test_recreate_from_savestate
/builddir/pyqtgraph/pyqtgraph/parametertree/parameterTypes/file.py:202: DeprecationWarning: Parameter has no default value. Pass a default, or use setDefault(). This will no longer set an implicit default after January 2025.
super().__init__(**opts)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================ short test summary info =============================================
FAILED tests/test_makeARGB.py::test_makeARGB_against_generated_references - AssertionError: Incorrect _makeARGB((<class 'numpy.float32'>, '2D', 'SIMPLE', None, None, True)) output! Expe...
FAILED tests/graphicsItems/test_ROI.py::test_PolyLineROI - AssertionError
======================= 2 failed, 447 passed, 10 skipped, 43 warnings in 670.58s (0:11:10) =======================
Tested environment(s)
- PyQtGraph version: 0.13.5.dev0
- Qt Python binding: PyQt5 5.15.10 Qt 5.15.11
- Python version: Python 3.12.0
- Operating system: linux
- Installation method: git clone
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels