Merge test data + make tests directory which contain tests#1807
Merge test data + make tests directory which contain tests#1807j9ac9k merged 15 commits intopyqtgraph:masterfrom
Conversation
|
For the segfaults, initially I was suspicious of Furthermore, they do not happen when running any single test by itself. |
|
found a bunch more tests, migrated them over as well, ...segfaults occur in
this command runs without any errors! 😆 |
|
now that the CI is looking at the tests directory, the segfault shows up there too, so at least we have that going for us... |
|
I can no longer reproduce a segfault locally, but two segfaults in the CI is enough to make me suspicious. |
|
Last two runs have shown no segfaults; will rerun a few more times to build some confidence in the results. |
b8e625a to
1a04650
Compare
|
Tests are migrated over, static code quality checker is fine, "silenced" exceptions have been addressed. I think the next step is to regenerate images with Qt5 (or Qt6), and tighten the tolerance for assertImageApproved for Qt5 and Qt6. |
|
Good news regarding the pixel tolerance, it does not appear to be needed when the images are generated using Qt6 bindings. I've only done the PlotCurveItem images, I'm going to do the other images shortly (I'm setup to do one at a time, so it's going to take a bit!). |
|
ok, I made CI angry; ...will investigate more later. With the new images, EDIT: I can replicate locally; must be something I just did....will investigate more later tonight |
|
passes on macOS, segafaults on linux, crashes on windows, "works on my machine!" EDIT: looks like it didn't like my changes to |
|
If you want to refactor into the function getImageFromWidget(), then imageToArray() needs to be called with copy=True, or manually make a copy of the resultant ndarray. |
I'll keep that in mind, but I reverted that change (due to the segfaults on ubuntu).... I may look to refactor it out, as I think it can provide useful functionality on its own; but right now I'm debating how to pass the assertImageAppoved tests, without having to provide a fudge-factor for Windows systems, which at a glance looks like what I will have to do. |
|
Oh the (pg.ROI([1, 1], [27, 28], pen='y'), 'baseroi'),
(pg.RectROI([1, 1], [27, 28], pen='y'), 'rectroi'),The other ones pass (pg.EllipseROI([1, 1], [27, 28], pen='y'), 'ellipseroi'),
(pr, 'polylineroi'), |
|
Just noticed the following comment in the code: # on windows, one edge of one ROI handle is shifted slightly; letting this slide with pxCount=10This was applied to one of the tests failing; but not to all the ones failing... |
8cae3fe to
550a512
Compare
|
I'm doing some last minute cleanup on this PR, I'm going to let it sit for a day, and merge, so we can get back to #1796 and ensure the image tests pass that way. |
|
Ok, now I think this PR is ready. |
dff4a89 to
62cc14c
Compare
|
@pijyoi the static code analyzer doesn't like the change to if depth in (8, 24, 32):
dtype = np.uint8
nchan = depth // 8
elif depth in (16, 64):
dtype = np.uint16
nchan = depth // 16
shape = qimg.height(), qimg.width()
if nchan != 1:
shape = shape + (nchan,)
data = np.frombuffer(img_ptr, dtype=dtype).reshape(shape)
return dataSpecifically, it is complaining about |
|
Sure, please fix it with a ValueError, unsupported image type. |
3aceb60 to
d69b9fa
Compare
|
UPDATE: It seems that the commit 510626c that added the test was already generating the bottom image! cmap = ColorMap(pos=[0.0, 1.0], color=[(0.0, 0.0, 0.0, 1.0), (1.0, 1.0, 1.0, 1.0)])should perhaps be cmap = ColorMap(pos=[0.0, 1.0], color=[(0, 0, 0), (255, 255, 255)])I am not familiar with ColorMap usage, so maybe @NilsNemitz could help here. |
|
Nice catch ! Will try looking into it in a few hours.
…On Mon, May 31, 2021 at 18:20 pijyoi ***@***.***> wrote:
nonuniform_image/colormap-3x3.png looks very different. Probably due to
some older PR breaking things w/o the test suite catching it.
master
[image: colormap-3x3]
<https://user-images.githubusercontent.com/2657027/120253463-fcbe4b80-c2b9-11eb-8c9a-94903f83ad17.png>
this PR
[image: colormap-3x3]
<https://user-images.githubusercontent.com/2657027/120253488-119adf00-c2ba-11eb-8591-8a8ef4dc35aa.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1807 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE5Z7TFI5EW5TJFZOHNZALTQQYWXANCNFSM45V2YO6Q>
.
|
|
@pijyoi you are spot on: I'll see if I can reuse the image that's still on EDIT: Sure enough, looks like I'll have to regenerate: |
To reduce complexity, and make it easier to add more images and tests, the images in the `test-data` repository should be merged with the main repository. Furthermore, we can remove a lot of the subprocess work in the image_testing.py file, as we no longer need to have it interact with git. The images are not the same. Images were regenerated with Qt6, and now have proper big and little endian handling thanks to @pijyoi Second commit is a slightly modified variant of 2e135ab authored by @pijyoi it is to convert qimages to RGBA8888 for testing. Image files were regenerated images for the big/little handling Fixed issue with bogus test from test_NonUniformImage and generated a new image
the test_signalproxy.py had a fixture for the QApplication instance, only problem is at the end of each use of the fixture, it would mark the application instance for deletion, which is most definitely not what we want
Remove if __name__ == "__main__" bits, replace some == None to is None checks Cleanup variety of static code checker issue Removed missing imports, restructured some logic to make a little cleaner, fixed a function in test_dockarea, unfortunately broke the test so now I tell pytest to expect the Exception.
While this fix prevents an assertion error, the assertion error was being suppressed; and was only noticeable via pytest -s where the error was printed to console. Future work should be done to minimize the use of bare exceptions so these tests do not fail silently
This file contains two tests, one of which has been skipped forever, and the second (test_pg_exit) has been a flakey test that does not test in general, testing a use-case we likely do not see any more. So therefore I am removing this test from the library.
This issue was flagged as a security issue in the static code analyzer
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
The way we called subprocess.Popen, it looks like we didn't close all the pipes; this PR addresses the warning that pytest generates when running the examples. In addition, we toggle the pytest setting to error on any warning
Several bugs have snuck through due to being wrapped with printExc, which would prevent the exception from raising, but printing the trace to the console. In pytest, this output is not captured at all, and is invisible unless the -s parameter is added. This PR changes the print statement to a runtime warning, which pytest will capture.
|
Updated the PR , unless anyone spots anything funky (including my screwing up of my git history, which I've only done a dozen or so times on this branch), I think this should be ready to merge (of course pending the result of the static code checker). |





This PR aims to get pyqtgraph in-line with standard python package directory structures, by creating a
testsdirectory on the root level, and putting all tests in there, including the images from test-data repository. The best example of this is in the "Good Integration Practices" on the pytest documentation page.Instead of just copying the images, I generated new images with Qt6, which the test suite passed with out of the box for the most part, even after resetting the pxCount to 0 for Qt5 and Qt6. On windows, some of the ROI tests had a few pixels off, but setting pxCount to 2 there seemed to address the issue (which is much smaller than the 10 it was before for Qt5).
With
setup.pywe can ensure that test data is not bundled with the pip package, and we can get more reliable use ofconftest.pyfiles (which we make minimal use of presently).While doing the huge shuffle of the test suite, a number of issues presented themselves (including a call to
QApplication.instance().deleteLater()). As I addressed them; I realized that the test suite no longer emits warnings; so I addressed #1025. Turns out pytest runs into an unraisable exception with how we call our examples, which this was addressed.I took the opportunity to fix some of the issues the static code checker had flagged (non-secure temporary files), and I modified
debug.printExcso it doesn't just print an exception (while suppressing it), but it actually raises a Runtime Warning. This is to prevent the case of #1804 where the exception was swallowed by this mechanism, despite there being a test to catch that very thing.Unfortunately, on my local machine, I'm triggering segfaults withtest_ImageItem.py,test_NonUniformImage.pyandtest_InfiniteLine.py. Until these segfaults are resolved, I'm leaving this PR in draft form.Fixes #1025
Fixes #1064