What changed, and why it matters
This commit simply removes an unused dependency called 'psutil' from the Monero test suite. It updates documentation and build checks to no longer require psutil, and deletes a helper function that reported available RAM during a mining test. There is no indication this fixes or introduces a security issue.
No security action needed. This is a routine test-maintenance change. Reviewers may verify that the removed RAM warning is no longer desired and that functional tests still run without psutil.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit removes the Python ‘psutil’ package from the functional tests. Changes include: updating tests/README.md dependency list, updating CMake check for required Python modules, removing the get_available_ram() method and its call in tests/functional_tests/mining.py, and removing the available_ram_gb() helper and psutil import in tests/functional_tests/util_resources.py. The removed code only printed available RAM and issued a non-blocking warning; it had no runtime effect on Monero daemon/wallet code.
Changed components
tests/functional_tests/mining.pytests/functional_tests/util_resources.pytests/functional_tests/CMakeLists.txttests/README.mdInspect captured patch +3 / −21
diff --git a/tests/README.md b/tests/README.md
index d2bea14..24cc5ba 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -50,7 +50,7 @@ Functional tests are located under the `tests/functional_tests` directory.
Building all the tests requires installing the following dependencies:
```bash
-pip install requests psutil zmq deepdiff
+pip install requests zmq deepdiff
```
First, run a regtest daemon in the offline mode and with a fixed difficulty:
diff --git a/tests/functional_tests/CMakeLists.txt b/tests/functional_tests/CMakeLists.txt
index 64613fc..41b8231 100644
--- a/tests/functional_tests/CMakeLists.txt
+++ b/tests/functional_tests/CMakeLists.txt
@@ -68,7 +68,7 @@ monero_add_minimal_executable(cpu_power_test cpu_power_test.cpp)
find_package(Python3 REQUIRED)
-execute_process(COMMAND ${Python3_EXECUTABLE} "-c" "import requests; import psutil; import zmq; import deepdiff; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${Python3_EXECUTABLE} "-c" "import requests; import zmq; import deepdiff; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
if (REQUESTS_OUTPUT STREQUAL "OK")
add_test(
NAME functional_tests_rpc
@@ -77,7 +77,7 @@ if (REQUESTS_OUTPUT STREQUAL "OK")
NAME check_missing_rpc_methods
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/check_missing_rpc_methods.py" "${CMAKE_SOURCE_DIR}")
else()
- message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'psutil', 'zmq', and 'deepdiff' python modules")
+ message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'zmq', and 'deepdiff' python modules")
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} functional_tests_rpc check_missing_rpc_methods)
if (EXPECT_FUNCTIONAL_TESTS)
message(FATAL_ERROR "Functional tests are expected")
diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py
index d49176b..22b5176 100755
--- a/tests/functional_tests/mining.py
+++ b/tests/functional_tests/mining.py
@@ -92,7 +92,6 @@ class MiningTest():
time_pi_single_cpu = self.measure_cpu_power_get_time(cores_mine)
time_pi_all_cores = self.measure_cpu_power_get_time(cores_init)
# This is the last measurement, since it takes very little time and can be placed timewise-closer to the mining itself.
- available_ram = self.get_available_ram() # So far no ideas how to use this var, other than printing it
start = time.monotonic()
daemon = Daemon()
@@ -221,16 +220,6 @@ class MiningTest():
self.print_mining_info("Time taken to calculate Pi on {} core(s) was {:.2f} s.".format(cores, time_pi))
return time_pi
- def get_available_ram(self):
- available_ram = util_resources.available_ram_gb()
- threshold_ram = 3
- self.print_mining_info("Available RAM = " + str(round(available_ram, 1)) + " GB")
- if available_ram < threshold_ram and not self.is_mining_silent():
- print("Warning! Available RAM =", round(available_ram, 1),
- "GB is less than the reasonable threshold =", threshold_ram,
- ". The RX init might exceed the calculated timeout.")
- return available_ram
-
def submitblock(self):
print("Test submitblock")
diff --git a/tests/functional_tests/util_resources.py b/tests/functional_tests/util_resources.py
index f5ef451..6f9593e 100755
--- a/tests/functional_tests/util_resources.py
+++ b/tests/functional_tests/util_resources.py
@@ -35,16 +35,9 @@
"""
import subprocess
-import psutil
import os
import errno
-def available_ram_gb():
- ram_bytes = psutil.virtual_memory().available
- kilo = 1024.0
- ram_gb = ram_bytes / kilo**3
- return ram_gb
-
def get_time_pi_seconds(cores, app_dir='.'):
app_path = '{}/cpu_power_test'.format(app_dir)
time_calc = subprocess.check_output([app_path, str(cores)])
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.