I don't think this test is actually doing what you expect, because the ``errno`` is not set. I suspect this test only passes because the code unintentionally (see comment above) silences other kinds of ``OSError``.