Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: py3k
Changeset: r61572:01ed12fd958d
Date: 2013-02-21 23:41 +0100
http://bitbucket.org/pypy/pypy/changeset/01ed12fd958d/

Log:    Fix docstring-only test functions (a hack to test python3-only
        syntax)

diff --git a/pypy/tool/pytest/apptest.py b/pypy/tool/pytest/apptest.py
--- a/pypy/tool/pytest/apptest.py
+++ b/pypy/tool/pytest/apptest.py
@@ -118,7 +118,11 @@
             defs.append("self.%s = %s\n" % (symbol, py3k_repr(value)))
     source = py.code.Source(target_)[1:]
     pyfile = udir.join('src.py')
-    target_name = target_.__name__
+    if isinstance(target_, str):
+        # Special case of a docstring; the function name is the first word.
+        target_name = target_.split('(', 1)[0]
+    else:
+        target_name = target_.__name__
     with pyfile.open('w') as f:
         f.write(helpers)
         f.write('\n'.join(defs))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to