Merge fix from validate.py to test.py

Let's keep these in sync.

Change-Id: I4f8cf4a8656f1a73df4243f68ce5866886de6c9f
Merge "Merge fix from validate.py to test.py"