Error loading core hook, seems correct

I am getting this error when running some integration tests, at the point where I call context_from_entity . I checked that there isn’t a .pyc file, and there is exactly one class deriving from Hook (haven’t changed anything in there). I see that this hook is marked as deprecated.
The same happens on Windows and Linux.
Strangely, this only happens when I run these tests with others; when I run them individually, they pass.
Any clues?

E           tank.util.loader.TankLoadPluginError: Error loading the file '/projects/shotgun_config/btltest3/install/core/hooks/'. Couldn't find a single class deriving from 'Hook'. You need to have exactly one class defined in the file deriving from that base class. If your file looks fine, it is possible that the cached .pyc file that python generates is invalid and this is causing the error. In that case, please delete the .pyc file and try again.

You may need to destroy your engine instance between tests?

Thanks Patrick, yes I do have

    if sgtk.platform.current_engine():

right before that. And I think start_engine registers the current engine, so it should work.
I’ll do some more investigation, just weird that this specific hook is causing the problems.