pytest-memray icon indicating copy to clipboard operation
pytest-memray copied to clipboard

Cannot get report for all tests

Open deepix opened this issue 3 years ago • 3 comments

Bug Report

When I run pytest with memray enabled and --most-allocations=0, I get an error at the end of pytest.

Backtrace

...
  File "/code/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/code/venv/lib/python3.8/site-packages/pytest_memray/plugin.py", line 195, in pytest_terminal_summary
    for test_id, total_size in total_sizes.most_common(max_results):
  File "/usr/local/lib/python3.8/collections/__init__.py", line 570, in most_common
    return _heapq.nlargest(n, self.items(), key=_itemgetter(1))
  File "/usr/local/lib/python3.8/heapq.py", line 540, in nlargest
    if n >= size:
TypeError: '>=' not supported between instances of 'str' and 'int'

Expected behavior/code I expected to see allocation reports for all tests.

Environment

  • Python(s): python3.8

Possible Solution

deepix avatar Oct 14 '22 20:10 deepix

Oh, interesting. Could you give us a link to your project or the tests you are running so we can try to reproduce it?

pablogsal avatar Oct 14 '22 20:10 pablogsal

I'm closing this issue as we don't have a reproducer. Please, feel free to reopen if you manage to get a simple example we can run to check the error.

pablogsal avatar Nov 15 '22 14:11 pablogsal

This is also a problem for me. @pablogsal

juliannguyen4 avatar Sep 22 '23 15:09 juliannguyen4