kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Testing - Replace Linux only 'resource' library with cross-platform 'psutil' library (#3037)
rodzic
73189672c3
commit
70a18ee4b5
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
import resource
|
||||
import psutil
|
||||
import time
|
||||
from threading import Thread
|
||||
|
||||
|
@ -28,9 +28,10 @@ def reportlog(pytestconfig):
|
|||
|
||||
|
||||
def track_memory(memory_usage, ):
|
||||
process = psutil.Process(os.getpid())
|
||||
while not memory_usage["stop"]:
|
||||
max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
|
||||
memory_usage["peak"] = max(memory_usage["peak"], max_rss)
|
||||
current_rss = process.memory_info().rss
|
||||
memory_usage["peak"] = max(memory_usage["peak"], current_rss)
|
||||
time.sleep(0.01) # Adjust the sleep time as needed
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
|
|
@ -110,5 +110,5 @@ tzdata
|
|||
|
||||
pluggy ~= 1.5
|
||||
|
||||
|
||||
|
||||
# Needed for testing, cross-platform for process and system monitoring
|
||||
psutil==7.0.0
|
||||
|
|
Ładowanie…
Reference in New Issue