Fix failures caused by static factory.

Can't register it separately for each test, as it'll just end up
using the first one. And the API doesn't let you remove factories :(