bloomberg / pytest-memray

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

compare memory usage between pytest runs #7

Closed djarecka closed 10 months ago

djarecka commented 2 years ago

Feature Request

Perhaps it will be useful if you can compare if tests are not using more memory after new changes.

pablogsal commented 2 years ago

Thanks! We will consider doing this feature but a workaround today is to check how much memory is using the test and then use the limit marker with the current memory usage. That way if the test is using more memory it will fail.

petr-tik commented 2 years ago

feels like this could be implemented using the pytest core cache fixture https://docs.pytest.org/en/6.2.x/cache.html#cache

the reporter can mirror the information it already prints to the terminal and cache it as well. Then print a warning if the test still passes, but uses more memory (even without the limit_memory marker?)