2 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/873a5c8e75a1/ changeset: 873a5c8e75a1 user: gutworth date: 2011-07-13 20:33:54 summary: respect sys.dont_write_bytecode and PYTHONDONTWRITEBYTECODE affected #: 3 files (485 bytes)
--- a/CHANGELOG Tue Jul 12 17:09:14 2011 -0500 +++ b/CHANGELOG Wed Jul 13 13:33:54 2011 -0500 @@ -1,6 +1,7 @@ Changes between 2.1.0 and 2.1.1.DEV ---------------------------------------------- +- don't cache rewritten modules if bytecode generation is disabled - fix assertion rewriting in read-only directories - fix issue59: provide system-out/err tags for junitxml output - fix assertion rewriting on boolean operations with 3 or more operands --- a/_pytest/assertion/rewrite.py Tue Jul 12 17:09:14 2011 -0500 +++ b/_pytest/assertion/rewrite.py Wed Jul 13 13:33:54 2011 -0500 @@ -89,14 +89,14 @@ # tricky race conditions, we maintain the following invariant: The # cached pyc is always a complete, valid pyc. Operations on it must be # atomic. POSIX's atomic rename comes in handy. + write = not sys.dont_write_bytecode cache_dir = os.path.join(fn_pypath.dirname, "__pycache__") - try: - py.path.local(cache_dir).ensure(dir=True) - except py.error.EACCES: - state.trace("read only directory: %r" % (fn_pypath.dirname,)) - write = False - else: - write = True + if write: + try: + py.path.local(cache_dir).ensure(dir=True) + except py.error.EACCES: + state.trace("read only directory: %r" % (fn_pypath.dirname,)) + write = False cache_name = fn_pypath.basename[:-3] + "." + PYTEST_TAG + ".pyc" pyc = os.path.join(cache_dir, cache_name) # Notice that even if we're in a read-only directory, I'm going to check --- a/testing/test_assertrewrite.py Tue Jul 12 17:09:14 2011 -0500 +++ b/testing/test_assertrewrite.py Wed Jul 13 13:33:54 2011 -0500 @@ -277,3 +277,13 @@ assert "@py_builtins" in globals()""") sub.chmod(320) assert testdir.runpytest().ret == 0 + + def test_dont_write_bytecode(self, testdir, monkeypatch): + testdir.makepyfile(""" +import os +def test_no_bytecode(): + assert "__pycache__" in __cached__ + assert not os.path.exists(__cached__) + assert not os.path.exists(os.path.dirname(__cached__))""") + monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1") + assert testdir.runpytest().ret == 0 http://bitbucket.org/hpk42/pytest/changeset/88a3b8eab308/ changeset: 88a3b8eab308 user: gutworth date: 2011-07-13 20:34:24 summary: merge heads affected #: 4 files (103 bytes) --- a/_pytest/__init__.py Wed Jul 13 13:33:54 2011 -0500 +++ b/_pytest/__init__.py Wed Jul 13 13:34:24 2011 -0500 @@ -1,2 +1,2 @@ # -__version__ = '2.1.1.dev2' +__version__ = '2.1.1.dev3' --- a/_pytest/junitxml.py Wed Jul 13 13:33:54 2011 -0500 +++ b/_pytest/junitxml.py Wed Jul 13 13:34:24 2011 -0500 @@ -115,15 +115,13 @@ self.skipped += 1 else: sec = dict(report.sections) - fmt = '<failure message="test failure">%s' - args = [report.longrepr] + self.appendlog('<failure message="test failure">%s</failure>', + report.longrepr) for name in ('out', 'err'): content = sec.get("Captured std%s" % name) if content: - fmt += "<system-%s>%%s</system-%s>" % (name, name) - args.append(content) - fmt += "</failure>" - self.appendlog(fmt, *args) + self.appendlog( + "<system-%s>%%s</system-%s>" % (name, name), content) self.failed += 1 self._closetestcase() --- a/setup.py Wed Jul 13 13:33:54 2011 -0500 +++ b/setup.py Wed Jul 13 13:34:24 2011 -0500 @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.1.1.dev2', + version='2.1.1.dev3', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], --- a/testing/test_junitxml.py Wed Jul 13 13:33:54 2011 -0500 +++ b/testing/test_junitxml.py Wed Jul 13 13:34:24 2011 -0500 @@ -150,9 +150,11 @@ fnode = tnode.getElementsByTagName("failure")[0] assert_attr(fnode, message="test failure") assert "ValueError" in fnode.toxml() - systemout = fnode.getElementsByTagName("system-out")[0] + systemout = fnode.nextSibling + assert systemout.tagName == "system-out" assert "hello-stdout" in systemout.toxml() - systemerr = fnode.getElementsByTagName("system-err")[0] + systemerr = systemout.nextSibling + assert systemerr.tagName == "system-err" assert "hello-stderr" in systemerr.toxml() def test_failure_escape(self, testdir): 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. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn