Skip to content

Commit 177a776

Browse files
committed
fix: make psutil dependency optional in system tests
1 parent c5ae4a7 commit 177a776

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎tests/system/test_psycopg_connection.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
import os
1717
import time
1818

19-
import psutil
19+
try:
20+
import psutil
21+
except ImportError:
22+
psutil = None
23+
24+
import pytest
2025

2126
from google.cloud.sql.connector import Connector
2227

@@ -29,6 +34,7 @@
2934
DB_NAME = os.getenv("DB_NAME", "postgres")
3035

3136

37+
@pytest.mark.skipif(psutil is None, reason="psutil package is not installed")
3238
def test_system_psycopg_resource_leak() -> None:
3339
"""Benchmark test to verify no resource leaks (threads, FDs, memory) between iteration 20 and 100."""
3440
print("\nStarting resource leak benchmark...")

0 commit comments

Comments
 (0)