bloomberg / pytest-memray

pytest plugin for easy integration of memray memory profiler
https://pytest-memray.readthedocs.io/en/latest/
Apache License 2.0
353 stars 25 forks source link

Cannot get report for all tests #46

Closed deepix closed 7 months ago

deepix commented 2 years ago

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

Possible Solution

pablogsal commented 2 years ago

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 commented 2 years ago

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.

juliannguyen4 commented 1 year ago

This is also a problem for me. @pablogsal