Skip to content

--memray causes built-in junit-xml results writer to fail #3

Closed
@petr-tik

Description

@petr-tik

Bug Report

Current Behavior A clear and concise description of the behavior.

python3.8 -m pytest --memray test_memray_marker.py --junit-xml=results.xml
============================================================================ test session starts ============================================================================
platform linux -- Python 3.8.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /tmp/tmp.RVJ6YYtLcB
plugins: memray-1.0.0
collected 1 item                                                                                                                                                            

test_memray_marker.py M
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/main.py", line 348, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/runner.py", line 109, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/runner.py", line 126, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/runner.py", line 219, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/junitxml.py", line 589, in pytest_runtest_logreport
INTERNALERROR>     reporter.append_failure(report)
INTERNALERROR>   File "/home/petr_tik/.local/lib/python3.8/site-packages/_pytest/junitxml.py", line 201, in append_failure
INTERNALERROR>     assert report.longrepr is not None
INTERNALERROR> AssertionError

Input Code

put this in a file called test_memray_marker.py

import pytest

@pytest.mark.limit_memory("10B")
def test_memray():
    _allocated_array = ["substring" * str_len for str_len in range(20)]
    print(_allocated_array)

    assert True

Expected behavior/code

Running this completes successfully without throwing InternalError - AssertionError

python3.8 -m pytest --memray test_memray_marker.py --junit-xml=results.xml

Environment

  • Python(s): python3.8, pytest-memray-1.0.0, pytest-6.2.5

Additional context/Screenshots

Thanks for the awesome pytest plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions