Pytestrunner fixes

This should fix the problems described at https://github.com/ariya/phantomjs/pull/12566#issuecomment-55694929