run-test.py refactoring