remove duplicated sleep function in tests. Fixes #1496.