It may be possible that fruit fly can pupate inside fruit, particularly if the flesh of the fruit is of drier consistency, e.g.: apples.
This is why it is so improtant to remove and dispose of all infested fruit to avoid future infestations occuring.
