[SOLVED][testing] applyProfile() vs isProductInstalled()?

A typical testing fixture looks like this where we all use applyProfile() for installing our add-ons involved in a particular fixture:

 33         def setUpPloneSite(self, portal):
 34             """Set up a Plone site.
 35             """
 36             applyProfile(portal, "plone.app.contenttypes:default")
 37             applyProfile(portal, "ugent.foldersorting:default")

Most add-ons have generated tests for testing the install/uninstall dance and use isProductInstalled().

However this is not symmetric with applyProfile().

An installed profile does not show up in listInstalledProducts()

(Pdb) portal.portal_quickinstaller.listInstalledProducts()

Only after an explicit installProduct() call, the add-on is really installed and can be tested for being installed:

(Pdb) portal.portal_quickinstaller.listInstalledProducts()
[{'id': 'ugent.foldersorting', 'title': 'ugent.foldersorting', 'status': 'installed', 'hasError': False, 'isLocked': False, 'isHidden': False, 'installedVersion': '0.2'}]
(Pdb) portal.portal_quickinstaller.isProductInstalled('ugent.foldersorting')

Anything missing here?

Do not use portal_quickinstaller for this. It may still work partially, as you can see, but the quick installer tool may no longer be aware that an add-on has been installed via portal_setup.
See the upgrade docs to Plone 5.1.
This should do the trick:

from Products.CMFPlone.utils import get_installer
qi = get_installer(portal)

Thanks, that helped. Obviously the old auto-generated code must be touched.

Plone Foundation Code of Conduct