diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 5bf7b13cd..17157b33d 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -122,7 +122,7 @@ class AssertionRewritingHook(object): # One of the path components was not a directory, likely # because we're in a zip file. write = False - elif e == errno.EACCES: + elif e in [errno.EACCES, errno.EROFS]: state.trace("read only directory: %r" % fn_pypath.dirname) write = False else: