Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/_vmprof/test/test__vmprof.py::AppTestVMProf::()::test_import_vmprof

self = <CallInfo when='call' exception: assert 14560 >= (14566 + 2)>
func = <function <lambda> at 0x0bd98650>, when = 'call'

    def __init__(self, func, when):
        #: context of invocation: one of "setup", "call",
        #: "teardown", "memocollect"
        self.when = when
        self.start = time()
        try:
>           self.result = func()

../_pytest/runner.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   return CallInfo(lambda: ihook(item=item, **kwds), when=when)

../_pytest/runner.py:138: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_HookCaller 'pytest_runtest_call'>
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_vmprof'>}

    def __call__(self, **kwargs):
        assert not self.is_historic()
>       return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)

../_pytest/vendored_packages/pluggy.py:724: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.config.PytestPluginManager object at 0xf4dfbb90>
hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_vmprof'>}

    def _hookexec(self, hook, methods, kwargs):
        # called from all hookcaller instances.
        # enable_tracing will set its own wrapping function at self._inner_hookexec
>       return self._inner_hookexec(hook, methods, kwargs)

../_pytest/vendored_packages/pluggy.py:338: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

hook = <_HookCaller 'pytest_runtest_call'>, methods = []
kwargs = {'__multicall__': <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>, 'item': <AppTestMethod 'test_import_vmprof'>}

    self._inner_hookexec = lambda hook, methods, kwargs: \
>       _MultiCall(methods, kwargs, hook.spec_opts).execute()

../_pytest/vendored_packages/pluggy.py:333: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>

    def execute(self):
        all_kwargs = self.kwargs
        self.results = results = []
        firstresult = self.specopts.get("firstresult")
    
        while self.hook_impls:
            hook_impl = self.hook_impls.pop()
            args = [all_kwargs[argname] for argname in hook_impl.argnames]
            if hook_impl.hookwrapper:
>               return _wrapped_call(hook_impl.function(*args), self.execute)

../_pytest/vendored_packages/pluggy.py:595: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

wrap_controller = <generator object pytest_runtest_call at 0x0bdb2148>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ort_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>

    def _wrapped_call(wrap_controller, func):
        """ Wrap calling to a function with a generator which needs to yield
        exactly once.  The yield point will trigger calling the wrapped function
        and return its _CallOutcome to the yield point.  The generator then needs
        to finish (raise StopIteration) in order for the wrapped call to complete.
        """
        try:
            next(wrap_controller)   # first yield
        except StopIteration:
            _raise_wrapfail(wrap_controller, "did not yield")
        call_outcome = _CallOutcome(func)
        try:
            wrap_controller.send(call_outcome)
            _raise_wrapfail(wrap_controller, "has second yield")
        except StopIteration:
            pass
>       return call_outcome.get_result()

../_pytest/vendored_packages/pluggy.py:253: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x0bd7bed4>

    def get_result(self):
        if self.excinfo is None:
            return self.result
        else:
            ex = self.excinfo
            if _py3:
                raise ex[1].with_traceback(ex[2])
>           _reraise(*ex)  # noqa

../_pytest/vendored_packages/pluggy.py:279: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_pytest.vendored_packages.pluggy._CallOutcome instance at 0x0bd7bed4>
func = <bound method _MultiCall.execute of <_MultiCall 0 results, 0 meths, kwargs={'i...ort_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>>

    def __init__(self, func):
        try:
>           self.result = func()

../_pytest/vendored_packages/pluggy.py:264: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_MultiCall 0 results, 0 meths, kwargs={'item': <AppTestMethod 'test_import_vmprof'>, '__multicall__': <_MultiCall 0 results, 0 meths, kwargs={...}>}>

    def execute(self):
        all_kwargs = self.kwargs
        self.results = results = []
        firstresult = self.specopts.get("firstresult")
    
        while self.hook_impls:
            hook_impl = self.hook_impls.pop()
            args = [all_kwargs[argname] for argname in hook_impl.argnames]
            if hook_impl.hookwrapper:
                return _wrapped_call(hook_impl.function(*args), self.execute)
>           res = hook_impl.function(*args)

../_pytest/vendored_packages/pluggy.py:596: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <AppTestMethod 'test_import_vmprof'>

    def pytest_runtest_call(item):
        try:
>           item.runtest()

../_pytest/runner.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <AppTestMethod 'test_import_vmprof'>

    def runtest(self):
        target = self.obj
        if self.config.option.runappdirect:
>           return target()

tool/pytest/apptest.py:98: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pypy.module._vmprof.test.test__vmprof.AppTestVMProf object at 0x0bd94550>

    def test_import_vmprof(self):
        tmpfile = open(self.tmpfilename, 'wb')
        tmpfileno = tmpfile.fileno()
        tmpfile2 = open(self.tmpfilename2, 'wb')
        tmpfileno2 = tmpfile2.fileno()
    
        import struct, sys, gc
    
        WORD = struct.calcsize('l')
    
        def count(s):
            i = 0
            count = 0
            i += 5 * WORD # header
            assert s[i    ] == '\x05'    # MARKER_HEADER
            assert s[i + 1] == '\x00'    # 0
            assert s[i + 2] == '\x06'    # VERSION_TIMESTAMP
            assert s[i + 3] == '\x08'    # PROFILE_RPYTHON
            assert s[i + 4] == chr(4)    # len('pypy')
            assert s[i + 5: i + 9] == 'pypy'
            i += 9
            while i < len(s):
                if s[i] == '\x03':
                    break
                elif s[i] == '\x01':
                    i += 1
                    _, size = struct.unpack("ll", s[i:i + 2 * WORD])
                    i += 2 * WORD + size * struct.calcsize("P")
                    i += WORD    # thread id
                elif s[i] == '\x02':
                    i += 1
                    _, size = struct.unpack("ll", s[i:i + 2 * WORD])
                    count += 1
                    i += 2 * WORD + size
                elif s[i] == '\x06':
                    print(s[i:i+24])
                    i += 1+8+8+8
                elif s[i] == '\x07':
                    i += 1
                    # skip string
                    size, = struct.unpack("l", s[i:i + WORD])
                    i += WORD+size
                    # skip string
                    size, = struct.unpack("l", s[i:i + WORD])
                    i += WORD+size
                else:
                    raise AssertionError(ord(s[i]))
            return count
    
        import _vmprof
        gc.collect()  # try to make the weakref list deterministic
        gc.collect()  # by freeing all dead code objects
        _vmprof.enable(tmpfileno, 0.01, 0, 0, 0, 0)
        _vmprof.disable()
        s = open(self.tmpfilename, 'rb').read()
        no_of_codes = count(s)
        assert no_of_codes > 10
        d = {}
    
        exec """def foo():
                pass
            """ in d
    
        gc.collect()
        gc.collect()
        _vmprof.enable(tmpfileno2, 0.01, 0, 0, 0, 0)
    
        exec """def foo2():
                pass
            """ in d
    
        _vmprof.disable()
        s = open(self.tmpfilename2, 'rb').read()
        no_of_codes2 = count(s)
        assert "py:foo:" in s
        assert "py:foo2:" in s
>       assert no_of_codes2 >= no_of_codes + 2 # some extra codes from tests
E       assert 14560 >= (14566 + 2)

module/_vmprof/test/test__vmprof.py:91: AssertionError
---------- Captured stdout call ----------

��j��

��j��
builder: pypy-c-jit-linux-x86-32 build #8504+
test: pypy/module/_vmprof/test/test__vmprof.py::AppTestVMProf::()::test_import_vmprof