From 2956627b8b08ad651f706d8a24104b6af1f6b2cc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 17 Oct 2015 11:50:49 +0200 Subject: [PATCH] Handle EPERM when writing rewritten bytecode. Fixes #1143. --- _pytest/assertion/rewrite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index b7a6c1c5e..9484ba4b3 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -128,7 +128,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 in [errno.EACCES, errno.EROFS]: + elif e in [errno.EACCES, errno.EROFS, errno.EPERM]: state.trace("read only directory: %r" % fn_pypath.dirname) write = False else: