Add test coverage for os.removedirs (#16775)