[pypy-svn] r24965 - pypy/branch/explicit-exceptions/translator/c/test

mwh at codespeak.net mwh at codespeak.net
Fri Mar 24 15:06:33 CET 2006


Author: mwh
Date: Fri Mar 24 15:06:22 2006
New Revision: 24965

Modified:
   pypy/branch/explicit-exceptions/translator/c/test/test_genc.py
Log:
delete a couple of tests testing SpaceOperation.cleanup.

the status on the branch is: the framework gc is broken.  the tests that don't
have an rtyper are broken.  there is a mystery failure in
test_backendoptimized.  everything else seems to work, but haven't tried a
translation yet.


Modified: pypy/branch/explicit-exceptions/translator/c/test/test_genc.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/test/test_genc.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/test/test_genc.py	Fri Mar 24 15:06:22 2006
@@ -298,91 +298,3 @@
 
     f1 = compile(f, [])
     assert f1() == 1
-
-# ____________________________________________________________
-# test for the 'cleanup' attribute of SpaceOperations
-class CleanupState(object):
-    pass
-cleanup_state = CleanupState()
-cleanup_state.current = 1
-def cleanup_g(n):
-    cleanup_state.saved = cleanup_state.current
-    try:
-        return 10 // n
-    except ZeroDivisionError:
-        raise
-def cleanup_h():
-    cleanup_state.current += 1
-def cleanup_f(n):
-    cleanup_g(n)
-    cleanup_h()     # the test hacks the graph to put this h() in the
-                    # cleanup clause of the previous direct_call(g)
-    return cleanup_state.saved * 100 + cleanup_state.current
-
-def test_cleanup_finally():
-    class DummyGCTransformer(NoneGcPolicy.transformerclass):
-        def transform_graph(self, graph):
-            super(DummyGCTransformer, self).transform_graph(graph)
-            if graph is self.translator.graphs[0]:
-                operations = graph.startblock.operations
-                op_call_g = operations[0]
-                op_call_h = operations.pop(1)
-                assert op_call_g.opname == "direct_call"
-                assert op_call_h.opname == "direct_call"
-                assert op_call_g.cleanup == ((), ())
-                assert op_call_h.cleanup == ((), ())
-                cleanup_finally = (op_call_h,)
-                cleanup_except = ()
-                op_call_g.cleanup = cleanup_finally, cleanup_except
-                op_call_h.cleanup = None
-
-    class DummyGcPolicy(NoneGcPolicy):
-        transformerclass = DummyGCTransformer
-
-    f1 = compile(cleanup_f, [int], backendopt=False, gcpolicy=DummyGcPolicy)
-    # state.current == 1
-    res = f1(1)
-    assert res == 102
-    # state.current == 2
-    res = f1(1)
-    assert res == 203
-    # state.current == 3
-    py.test.raises(ZeroDivisionError, f1, 0)
-    # state.current == 4
-    res = f1(1)
-    assert res == 405
-    # state.current == 5
-
-def test_cleanup_except():
-    class DummyGCTransformer(NoneGcPolicy.transformerclass):
-        def transform_graph(self, graph):
-            super(DummyGCTransformer, self).transform_graph(graph)
-            if graph is self.translator.graphs[0]:
-                operations = graph.startblock.operations
-                op_call_g = operations[0]
-                op_call_h = operations.pop(1)
-                assert op_call_g.opname == "direct_call"
-                assert op_call_h.opname == "direct_call"
-                assert op_call_g.cleanup == ((), ())
-                assert op_call_h.cleanup == ((), ())
-                cleanup_finally = ()
-                cleanup_except = (op_call_h,)
-                op_call_g.cleanup = cleanup_finally, cleanup_except
-                op_call_h.cleanup = None
-
-    class DummyGcPolicy(NoneGcPolicy):
-        transformerclass = DummyGCTransformer
-
-    f1 = compile(cleanup_f, [int], backendopt=False, gcpolicy=DummyGcPolicy)
-    # state.current == 1
-    res = f1(1)
-    assert res == 101
-    # state.current == 1
-    res = f1(1)
-    assert res == 101
-    # state.current == 1
-    py.test.raises(ZeroDivisionError, f1, 0)
-    # state.current == 2
-    res = f1(1)
-    assert res == 202
-    # state.current == 2



More information about the Pypy-commit mailing list