Author: Antonio Cuni <anto.c...@gmail.com> Branch: fix-vmprof-stacklet-switch-2 Changeset: r93194:ff5fd2e1f430 Date: 2017-11-28 16:09 +0100 http://bitbucket.org/pypy/pypy/changeset/ff5fd2e1f430/
Log: add a pytest finalizer to check that we called {start,stop}_sampling an even amount of times. I have no idea how to write a test for it, though :( diff --git a/rpython/rlib/rvmprof/test/support.py b/rpython/rlib/rvmprof/test/support.py --- a/rpython/rlib/rvmprof/test/support.py +++ b/rpython/rlib/rvmprof/test/support.py @@ -31,5 +31,12 @@ def fakevmprof(request, monkeypatch): fake = FakeVMProf() monkeypatch.setattr(rvmprof.rvmprof, '_vmprof_instance', fake) + # + def check_status(): + if fake._ignore_signals != 1: + msg = ('Invalid value for fakevmprof._ignore_signals: expected 1, ' + 'got %d. This probably means that you called ' + '{start,stop}_sampling() a wrong number of times') + raise ValueError, msg % fake._ignore_signals + request.addfinalizer(check_status) return fake - _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit