MySQL TRUNCATE TABLE blocks queries in other databases
TRUNCATE would have to invalidate all dependent queries in the query cache, so that's probably why it's taking a lock on it. If your query cache is sufficiently large, invalidation might take some time. Since MySQL "databases" are more like schemas, a single query cache is maintained for all databases in the MySQL instance, so there really is no isolation between them. 

You may want to consider disabling query cache or, better yet, using different MySQL instances for testing and production.