fix race condition in test.py