Skip to content

Commit

Permalink
feat: remove memory checking disabling in python integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
halajohn committed Dec 10, 2024
1 parent 513d22d commit 603f818
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand All @@ -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__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand All @@ -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__))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import subprocess
import os
import sys
import pytest
from sys import stdout
from .common import http, build_config, build_pkg

Expand All @@ -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__))
Expand Down

0 comments on commit 603f818

Please sign in to comment.