File: //opt/osm/venv/lib/python3.10/site-packages/psutil/tests/__pycache__/test_memleaks.cpython-310.pyc
o
=i�: � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd l
mZ dd
l
mZ ddl
m
Z
ddl
mZ dd
l
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
mZ ddl
m Z ej!j"Z"e�#� Z$dZ%d d!� Z&G d"d#� d#e�Z'G d$d%� d%e'�Z(ej)j*e d&d'�G d(d)� d)e��Z+G d*d+� d+e�Z,dS ),a� Tests for detecting function memory leaks (typically the ones
implemented in C). It does so by calling a function many times and
checking whether process memory usage keeps increasing between
calls or over time.
Note that this may produce false positives (especially on Windows
for some reason).
PyPy appears to be completely unstable for this framework, probably
because of how its JIT handles memory, so tests are skipped.
� N)�LINUX)�MACOS)�OPENBSD)�POSIX)�SUNOS)�WINDOWS)�AARCH64)�HAS_CPU_AFFINITY)�HAS_CPU_FREQ)�HAS_ENVIRON)�
HAS_IONICE)�HAS_MEMORY_MAPS)�HAS_NET_IO_COUNTERS)�HAS_PROC_CPU_NUM)�HAS_PROC_IO_COUNTERS)�
HAS_RLIMIT)�HAS_SENSORS_BATTERY)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)�TestMemoryLeak)�create_sockets)�
get_testfn)�process_namespace)�pytest)�skip_on_access_denied)�
spawn_subproc)�system_namespace)� terminate� c C s dd� } | S )zsDecorator for those Linux functions which are implemented in pure
Python, and which we want to run faster.
c s t �� �� fdd��}|S )Nc sV t r | jj}zt| j_� | g|�R i |��W || j_S || j_w � | g|�R i |��S �N)r � __class__�times� FEW_TIMES)�self�args�kwargs�before��fun� �H/opt/osm/venv/lib/python3.10/site-packages/psutil/tests/test_memleaks.py�wrapper= s z5fewtimes_if_linux.<locals>.decorator.<locals>.wrapper)� functools�wraps)r( r+ r) r'