From 603f8185bff0fcfee1b15e5dbaeabe42b225b175 Mon Sep 17 00:00:00 2001 From: Hu Yueh-Wei Date: Tue, 10 Dec 2024 15:59:00 +0800 Subject: [PATCH] feat: remove memory checking disabling in python integration test --- .../python/large_json_python/test_case.py | 33 ------------------- .../resp_handler_yield_python/test_case.py | 33 ------------------- .../send_recv_image_python/test_case.py | 33 ------------------- 3 files changed, 99 deletions(-) diff --git a/tests/ten_runtime/integration/python/large_json_python/test_case.py b/tests/ten_runtime/integration/python/large_json_python/test_case.py index 3d2c679696..51604208d8 100644 --- a/tests/ten_runtime/integration/python/large_json_python/test_case.py +++ b/tests/ten_runtime/integration/python/large_json_python/test_case.py @@ -5,42 +5,10 @@ import subprocess import os import sys -import pytest from sys import stdout from .common import http, build_config, build_pkg -@pytest.fixture(scope="function") -def manage_env_var_for_memory_issue_detection(): - original_ten_enable_memory_sanitizer = os.environ.get( - "TEN_ENABLE_MEMORY_TRACKING" - ) - original_asan_options = os.environ.get("ASAN_OPTIONS") - - # Set the environment variable before the test. - - # TODO(xilin): The TEN Python binding has a known memory leak. After - # resolving it, enable TEN_ENABLE_MEMORY_TRACKING=true. - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = "false" - - os.environ["ASAN_OPTIONS"] = "detect_leaks=0" - - yield - - # Remove the environment variable after the test. - if original_ten_enable_memory_sanitizer is not None: - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = ( - original_ten_enable_memory_sanitizer - ) - else: - del os.environ["TEN_ENABLE_MEMORY_TRACKING"] - - if original_asan_options is not None: - os.environ["ASAN_OPTIONS"] = original_asan_options - else: - del os.environ["ASAN_OPTIONS"] - - def http_request(): return http.post( "http://127.0.0.1:8002/", @@ -52,7 +20,6 @@ def http_request(): ) -@pytest.mark.usefixtures("manage_env_var_for_memory_issue_detection") def test_large_json_python(): """Test client and app server.""" base_path = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/ten_runtime/integration/python/resp_handler_yield_python/test_case.py b/tests/ten_runtime/integration/python/resp_handler_yield_python/test_case.py index 75380b56d6..5cd1715d18 100644 --- a/tests/ten_runtime/integration/python/resp_handler_yield_python/test_case.py +++ b/tests/ten_runtime/integration/python/resp_handler_yield_python/test_case.py @@ -5,42 +5,10 @@ import subprocess import os import sys -import pytest from sys import stdout from .common import http, build_config, build_pkg -@pytest.fixture(scope="function") -def manage_env_var_for_memory_issue_detection(): - original_ten_enable_memory_sanitizer = os.environ.get( - "TEN_ENABLE_MEMORY_TRACKING" - ) - original_asan_options = os.environ.get("ASAN_OPTIONS") - - # Set the environment variable before the test. - - # TODO(xilin): The TEN Python binding has a known memory leak. After - # resolving it, enable TEN_ENABLE_MEMORY_TRACKING=true. - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = "false" - - os.environ["ASAN_OPTIONS"] = "detect_leaks=0" - - yield - - # Remove the environment variable after the test. - if original_ten_enable_memory_sanitizer is not None: - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = ( - original_ten_enable_memory_sanitizer - ) - else: - del os.environ["TEN_ENABLE_MEMORY_TRACKING"] - - if original_asan_options is not None: - os.environ["ASAN_OPTIONS"] = original_asan_options - else: - del os.environ["ASAN_OPTIONS"] - - def http_request(): return http.post( "http://127.0.0.1:8002/", @@ -52,7 +20,6 @@ def http_request(): ) -@pytest.mark.usefixtures("manage_env_var_for_memory_issue_detection") def test_resp_handler_yield_python(): """Test client and app server.""" base_path = os.path.dirname(os.path.abspath(__file__)) diff --git a/tests/ten_runtime/integration/python/send_recv_image_python/test_case.py b/tests/ten_runtime/integration/python/send_recv_image_python/test_case.py index 2d8257a345..f3cd6692c6 100644 --- a/tests/ten_runtime/integration/python/send_recv_image_python/test_case.py +++ b/tests/ten_runtime/integration/python/send_recv_image_python/test_case.py @@ -5,7 +5,6 @@ import subprocess import os import sys -import pytest from sys import stdout from .common import http, build_config, build_pkg @@ -21,38 +20,6 @@ def http_request(): ) -@pytest.fixture(scope="function") -def manage_env_var_for_memory_issue_detection(): - original_ten_enable_memory_sanitizer = os.environ.get( - "TEN_ENABLE_MEMORY_TRACKING" - ) - original_asan_options = os.environ.get("ASAN_OPTIONS") - - # Set the environment variable before the test. - - # TODO(xilin): The TEN Python binding has a known memory leak. After - # resolving it, enable TEN_ENABLE_MEMORY_TRACKING=true. - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = "false" - - os.environ["ASAN_OPTIONS"] = "detect_leaks=0" - - yield - - # Remove the environment variable after the test. - if original_ten_enable_memory_sanitizer is not None: - os.environ["TEN_ENABLE_MEMORY_TRACKING"] = ( - original_ten_enable_memory_sanitizer - ) - else: - del os.environ["TEN_ENABLE_MEMORY_TRACKING"] - - if original_asan_options is not None: - os.environ["ASAN_OPTIONS"] = original_asan_options - else: - del os.environ["ASAN_OPTIONS"] - - -@pytest.mark.usefixtures("manage_env_var_for_memory_issue_detection") def test_send_recv_image_python(): """Test client and app server.""" base_path = os.path.dirname(os.path.abspath(__file__))