-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow logs from memray core #134
Comments
Memray doesn't use the Python You'll only see Memray's logs from the WARNING level and above, as that's the default threshold Memray sets. If you need to see logs from a lower level than that, you could apply a patch like this to diff --git a/src/pytest_memray/plugin.py b/src/pytest_memray/plugin.py
index c1f7d3d..f6fb9f8 100644
--- a/src/pytest_memray/plugin.py
+++ b/src/pytest_memray/plugin.py
@@ -3,6 +3,7 @@ from __future__ import annotations
import collections
import functools
import inspect
+import logging
import math
import os
import pickle
@@ -34,6 +35,7 @@ from pytest import Item
from pytest import Parser
from pytest import TestReport
from pytest import hookimpl
+from memray import set_log_level
from .marks import limit_memory
from .marks import limit_leaks
@@ -42,6 +44,8 @@ from .utils import positive_int
from .utils import sizeof_fmt
from .utils import value_or_ini
+set_log_level(logging.DEBUG)
+
class SectionMetadata(Protocol):
long_repr: str What are you trying to debug, specifically? |
Thanks, that works. I am trying to debug a segfault caused by memray interacting with greenlet which only seems to happen using pytest-memray and not memray. But I assume I should raise that in a separate issue thread? |
Yes, separate issue for that, please. |
I am currently unable to see any of the core memray logs when running pytest-memray with my project's test suite.
As an example, I am trying to see if support for greenlet is running inside memray when running pytest-memray, but I cannot get memray core to print or log any lines whether greenlet support is enabled or not. I have tried building memray from scratch and adding log lines and prints to both when greenlet is detected and not detected, but nothing shows up not matter how I run pytest-memray or what logging level I use. I can see the greenlet log when running pytest directly on memray without pytest-memray e.g.
memray run -m pytest ...
in the same environment.Perhaps this is already implemented somewhere, but I cannot find it on the docs or see an option to enable anything like this.
Ideally there would be an option to get output from core memray code, so we can debug issues directly when using pytest-memray without having to run pytest in memray.
The text was updated successfully, but these errors were encountered: