better optional dependency checking for lazy_test.py