[py-svn] commit/pytest: gutworth: factor out win32 checks
Bitbucket
commits-noreply at bitbucket.org
Fri Aug 19 01:15:39 CEST 2011
1 new changeset in pytest:
http://bitbucket.org/hpk42/pytest/changeset/c5de7cc58622/
changeset: c5de7cc58622
user: gutworth
date: 2011-08-19 01:15:30
summary: factor out win32 checks
affected #: 1 file (60 bytes)
--- a/_pytest/assertion/rewrite.py Thu Aug 18 22:52:02 2011 +0200
+++ b/_pytest/assertion/rewrite.py Thu Aug 18 18:15:30 2011 -0500
@@ -15,6 +15,12 @@
from _pytest.assertion import util
+# Windows gives ENOENT in places *nix gives ENOTDIR.
+if sys.platform.startswith("win"):
+ PATH_COMPONENT_NOT_DIR = errno.ENOENT
+else:
+ PATH_COMPONENT_NOT_DIR = errno.ENOTDIR
+
# py.test caches rewritten pycs in __pycache__.
if hasattr(imp, "get_tag"):
PYTEST_TAG = imp.get_tag() + "-PYTEST"
@@ -106,8 +112,7 @@
# common case) or it's blocked by a non-dir node. In the
# latter case, we'll ignore it in _write_pyc.
pass
- elif (e == errno.ENOTDIR or
- sys.platform == "win32" and e == errno.ENOENT):
+ elif e == PATH_COMPONENT_NOT_DIR:
# One of the path components was not a directory, likely
# because we're in a zip file.
write = False
@@ -160,8 +165,7 @@
fp = open(pyc, "wb")
except IOError:
err = sys.exc_info()[1].errno
- if (err == errno.ENOTDIR or
- sys.platform == "win32" and err == errno.ENOENT):
+ if err == PATH_COMPONENT_NOT_DIR:
# This happens when we get a EEXIST in find_module creating the
# __pycache__ directory and __pycache__ is by some non-dir node.
return False
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list