[pypy-commit] pypy vmprof-0.4.10: one more refactor

antocuni pypy.commits at gmail.com
Mon Nov 6 12:04:51 EST 2017


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: vmprof-0.4.10
Changeset: r92958:5f1804f818b4
Date: 2017-11-06 18:04 +0100
http://bitbucket.org/pypy/pypy/changeset/5f1804f818b4/

Log:	one more refactor

diff --git a/rpython/rlib/rvmprof/test/test_rvmprof.py b/rpython/rlib/rvmprof/test/test_rvmprof.py
--- a/rpython/rlib/rvmprof/test/test_rvmprof.py
+++ b/rpython/rlib/rvmprof/test/test_rvmprof.py
@@ -60,30 +60,23 @@
         assert self.rpy_entry_point() == 0
 
 
-def test_register_code():
-
-    class MyCode:
-        pass
-    try:
-        rvmprof.register_code_object_class(MyCode, lambda code: 'some code')
-    except rvmprof.VMProfPlatformUnsupported as e:
-        py.test.skip(str(e))
-
-    @rvmprof.vmprof_execute_code("xcode1", lambda code, num: code)
-    def main(code, num):
+class TestRegisterCode(RVMProfTest):
+    
+    @rvmprof.vmprof_execute_code("xcode1", lambda self, code, num: code)
+    def main(self, code, num):
         print num
         return 42
 
-    def f():
-        code = MyCode()
+    def entry_point(self):
+        code = self.MyCode()
         rvmprof.register_code(code, lambda code: 'some code')
-        res = main(code, 5)
+        res = self.main(code, 5)
         assert res == 42
         return 0
 
-    assert f() == 0
-    fn = compile(f, []) #, gcpolicy="minimark")
-    assert fn() == 0
+    def test(self):
+        assert self.entry_point() == 0
+        assert self.rpy_entry_point() == 0
 
 
 def test_enable():


More information about the pypy-commit mailing list