Issue #3131090 by longwave: Replace assertions involving calls to is_dir with assertDirectoryExists()/assertDirectoryNotExists() (cherry picked from commit 610d4b63)