Is there some crazy way to avoid pty's completely? I suspect they are inherently random trouble. I mean, tests presumably can't use a "real" terminal, pseudo or otherwise, it all has to be batch anyway. (Sorry for not actually looking at what you are doing with the ptys, likely I'm totally offbase.)
Another possibility: look at coreutils and/or gnulib test suites. maybe they do checks with ptys using methods that can be adapted. k