2 new changesets in pytest:

http://bitbucket.org/hpk42/pytest/changeset/98f68176bb3a/
changeset:   98f68176bb3a
user:        gutworth
date:        2011-08-29 16:10:00
summary:     add heading for next version
affected #:  1 file (83 bytes)

--- a/CHANGELOG Sat Aug 20 18:51:53 2011 +0200
+++ b/CHANGELOG Mon Aug 29 10:10:00 2011 -0400
@@ -1,3 +1,6 @@
+Changes between 2.1.1 and [NEXT VERSION]
+----------------------------------------
+
 Changes between 2.1.0 and 2.1.1
 ----------------------------------------------
 


http://bitbucket.org/hpk42/pytest/changeset/ae1c8f42b002/
changeset:   ae1c8f42b002
user:        gutworth
date:        2011-08-29 16:13:00
summary:     use different caches for optimized and unoptimized code (fixes #66)
affected #:  3 files (700 bytes)

--- a/CHANGELOG Mon Aug 29 10:10:00 2011 -0400
+++ b/CHANGELOG Mon Aug 29 10:13:00 2011 -0400
@@ -1,6 +1,8 @@
 Changes between 2.1.1 and [NEXT VERSION]
 ----------------------------------------
 
+- fix issue66: use different assertion rewriting caches when the -O option is 
passed
+
 Changes between 2.1.0 and 2.1.1
 ----------------------------------------------
 


--- a/_pytest/assertion/rewrite.py      Mon Aug 29 10:10:00 2011 -0400
+++ b/_pytest/assertion/rewrite.py      Mon Aug 29 10:13:00 2011 -0400
@@ -35,6 +35,9 @@
     PYTEST_TAG = "%s-%s%s-PYTEST" % (impl, ver[0], ver[1])
     del ver, impl
 
+PYC_EXT = ".py" + "c" if __debug__ else "o"
+PYC_TAIL = "." + PYTEST_TAG + PYC_EXT
+
 class AssertionRewritingHook(object):
     """Import hook which rewrites asserts."""
 
@@ -121,7 +124,7 @@
                     write = False
                 else:
                     raise
-        cache_name = fn_pypath.basename[:-3] + "." + PYTEST_TAG + ".pyc"
+        cache_name = fn_pypath.basename[:-3] + PYC_TAIL
         pyc = os.path.join(cache_dir, cache_name)
         # Notice that even if we're in a read-only directory, I'm going to 
check
         # for a cached pyc. This may not be optimal...


--- a/testing/test_assertrewrite.py     Mon Aug 29 10:10:00 2011 -0400
+++ b/testing/test_assertrewrite.py     Mon Aug 29 10:13:00 2011 -0400
@@ -326,3 +326,17 @@
     assert not os.path.exists(os.path.dirname(__cached__))""")
         monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
         assert testdir.runpytest().ret == 0
+
+    def test_pyc_vs_pyo(self, testdir, monkeypatch):
+        testdir.makepyfile("""
+import pytest
+def test_optimized():
+    "hello"
+    assert test_optimized.__doc__ is None""")
+        p = py.path.local.make_numbered_dir(prefix="runpytest-", keep=None,
+                                            rootdir=testdir.tmpdir)
+        tmp = "--basetemp=%s" % p
+        monkeypatch.setenv("PYTHONOPTIMIZE", "2")
+        assert testdir.runpybin("py.test", tmp).ret == 0
+        monkeypatch.undo()
+        assert testdir.runpybin("py.test", tmp).ret == 1

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

Reply via email to