testing: API for deferring a cleanup step when subtests use Parallel

A relatively common pattern is to run a test that has multiple subtests that can be run in parallel:
func TestSomething(t *testing.T) {
  t.Run("case1", func (t *testing.T) { t.Parallel(); ... })
  t.Run("case2", func (t *testing.T) { t.Parallel(); ... })
}

But what if the parent test needs to set something up and clean it up at the end? You'd be tempted to do:
func TestSomething(t *testing.T) {
  setup()
  defer cleanup()

  t.Run("case1", func (t *testing.T) { t.Parallel(); ... })
  t.Run("case2", func (t *testing.T) { t.Parallel(); ... })
}

Unfortunately this is not correct - cleanup will run too early, before the subtests finish (in fact, before they even get passed the Parallel() call).
Most CockroachDB tests use a defer leaktest.AfterTest(t)() call in the beginning that checks for stray goroutines; using Parallel() in subtests breaks that pattern.
My proposal is to add an API to T that runs a cleanup step after all subtests finish; defer cleanup() would become t.Defer(cleanup()) or similar.
Also, this gotcha should be called out in the documentation (https://github.com/golang/go/issues/23368 is related).

Ah.. I found this in the higher-level documentation:
func TestTeardownParallel(t *testing.T) {
    // This Run will not return until the parallel tests finish.
    t.Run("group", func(t *testing.T) {
        t.Run("Test1", parallelTest1)
        t.Run("Test2", parallelTest2)
        t.Run("Test3", parallelTest3)
    })
    // <tear-down code>
}

This is a good workaround for this problem (though it would still be better if there was an explicit API). Either way, I think there should be a pointer to this information in the documentation of Parallel.

/cc @mpvl


Loading all images from a folder

Hello,
Thank you so much for creating this repo.
What do I have to do in order to:

Load 1000 image names from a folder, populate your LHS image list with these names and then trigger image display upon clicking an image name on the list

Following that, I want to display the image and the normalized image side by side in the image pane

Thanks,

Hi there,
unless I misunderstand something, 1. should be easy to do. Via the command line, add tev to your PATH, then do tev path/to/folder/*. If you prefer using a file browser (e.g. explorer on Windows), make tev your default application for opening the type of image file you are using, then select all images in the given folder via Ctrl+A, and then press Enter. (Cmd+A; Cmd+Down on macOS.)
Your second use case is unfortunately not supported by tev. tev can only display a single image at a time.
Cheers!

Hi Tom!
Thanks for the prompt reply :)
I meant amending the code and the nanoGUI components directly and not via the command line (though its is nice that it is possible).
Something like this QT example:

Oh, I see! I think the easiest route would be to create 2 ImageCanvas widgets side-by-side (instead of having a single one like right now) and have ImageViewer set the image and display settings of both accordingly.
A slightly more direct (and hacky) approach would be to bake the normalized image and the original image into a larger image (with twice the width) within the respective image loading routines in Image.cpp.
Hope this helps! :)

Yes, it does. Thanks.
Any idea why loading a single JPG would take so long on a very strong computer?

Also, more than 3/4 of my images fail to load with this error:

Do I need to covert some of them to another format?
Many thanks!

Also, if I select 50 images (CTRL A), and the selct an Image it allways ends like this:


Add Developer Documentation For UCVM

Missing in the UCVM documentation are notes for developers - those who wish to integrate UCVM into their own Python programs and those who wish to contribute and create new models for UCVM. We need to write guides on how to do both of these for interested parties.

Added a short developer guide to the wiki as well as in the code. We still need a more extensive API guide, but that should be for the 17.6.0 milestone.


Popover: Add button options to popover (Figma)

There should be an option to add button group to the popover so you dont have to detach it.

Figma link: https://www.figma.com/file/vpM9dqqQPHqU6ogfKp5tlr/Felles-komponenter?type=design&node-id=17856%3A57104&mode=design&t=Sj0qsFnLKtlVQm21-1