[Pytest-commit] commit/pytest: hpk42: Merged in issue735 (pull request #302)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Jun 4 07:48:58 CEST 2015


1 new commit in pytest:

https://bitbucket.org/pytest-dev/pytest/commits/61d638f89acb/
Changeset:   61d638f89acb
User:        hpk42
Date:        2015-06-04 05:48:53+00:00
Summary:     Merged in issue735 (pull request #302)

use NameConstant node when it exists (fixes #735)
Affected #:  2 files

diff -r 44eb61fafecb5990112ac91b58d2496ed81a83b0 -r 61d638f89acbda40a49ccadcb4aebe06783200df CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 2.8.0.dev (compared to 2.7.X)
 -----------------------------
 
+- fix issue735: assertion failures on debug versions of Python 3.4+
+
 - change test module importing behaviour to append to sys.path
   instead of prepending.  This better allows to run test modules
   against installated versions of a package even if the package

diff -r 44eb61fafecb5990112ac91b58d2496ed81a83b0 -r 61d638f89acbda40a49ccadcb4aebe06783200df _pytest/assertion/rewrite.py
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -442,6 +442,13 @@
     ast.NotIn: "not in"
 }
 
+# Python 3.4+ compatibility
+if hasattr(ast, "NameConstant"):
+    _NameConstant = ast.NameConstant
+else:
+    def _NameConstant(c):
+        return ast.Name(str(c), ast.Load())
+
 
 def set_location(node, lineno, col_offset):
     """Set node location information recursively."""
@@ -680,7 +687,7 @@
         if self.variables:
             variables = [ast.Name(name, ast.Store())
                          for name in self.variables]
-            clear = ast.Assign(variables, ast.Name("None", ast.Load()))
+            clear = ast.Assign(variables, _NameConstant(None))
             self.statements.append(clear)
         # Fix line numbers.
         for stmt in self.statements:

Repository URL: https://bitbucket.org/pytest-dev/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