Created attachment 333218 [details, diff] Fix dependency handling with IUSE=test Following up on bug 311183 comment 4. Suggested patch attached.
Pushed to the tree. Thanks for reporting and sorry for not catching that sooner.