[Python] Warnings during pytest

Hello, i am getting the following warning message after run the pytest

/home/app/.local/lib/python3.8/site-packages/newrelic/core/application.py:26
/home/app/.local/lib/python3.8/site-packages/newrelic/core/application.py:26: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module’s documentation for alternative uses
import imp

/home/app/.local/lib/python3.8/site-packages/newrelic/console.py:84: 18 tests with warnings
/home/app/.local/lib/python3.8/site-packages/newrelic/console.py:84: DeprecationWarning: formatargspec is deprecated since Python 3.5. Use signature and the Signature object directly
prototype = wrapper.name[3:] + ’ ’ + inspect.formatargspec(

– Docs: https://docs.pytest.org/en/latest/warnings.html

----------- coverage: platform linux, python 3.8.2-final-0 -----------
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml

Python 3.8
Pytest 5.4
My Python agent is 5.18.0.148

Someone know how to solve this?

Thanks!

Hi Mco!

Thanks for bringing this to our attention. After investigating, it does look like we have something filed internally for this.

For now, as a workaround you could add something as follows to ignore deprecation warnings for the New Relic library:

import warnings
IGNORE_MODULES = 'newrelic'

warnings.filterwarnings("ignore", module=IGNORE_MODULES)

Let me know if that works!

Cheers,
Giselle