Author: Ronny Pfannschmidt <ronny.pfannschm...@gmx.de>
Branch: 
Changeset: r46920:bf7e78a0e3ac
Date: 2011-08-30 12:29 +0200
http://bitbucket.org/pypy/pypy/changeset/bf7e78a0e3ac/

Log:    make the syntax tree viewer use mkdtemp+remove after run when
        pytest.ensuretemp is not availiable (i.e. outside of testrun)

diff --git a/pypy/rlib/parsing/tree.py b/pypy/rlib/parsing/tree.py
--- a/pypy/rlib/parsing/tree.py
+++ b/pypy/rlib/parsing/tree.py
@@ -6,9 +6,16 @@
         content = ["digraph G{"]
         content.extend(self.dot())
         content.append("}")
-        p = py.test.ensuretemp("automaton").join("temp.dot")
+        try:
+            p = py.test.ensuretemp("automaton").join("temp.dot")
+            remove = False
+        except AttributeError: # pytest lacks ensuretemp, make a normal one
+            p = py.path.local.mkdtemp().join('automaton.dot')
+            remove = True
         p.write("\n".join(content))
         graphclient.display_dot_file(str(p))
+        if remove:
+            p.dirpath().remove()
 
 class Symbol(Node):
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to