fix mocking of sanity_check in tests
fix is_dir method in posix.py