rewrite test script in python to be more cross-platform