From 0c0835dfdf22c9a45f1394fa8ae0dc367ee77f38 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 31 May 2023 17:13:11 -0400 Subject: [PATCH] Import memory_profiler only when it is enabled This removes the test dependency on https://pypi.org/project/memory-profiler/ when the PROFILE_MEMORY environment variable is not set. --- tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests.py b/tests.py index ae421f6..260f30c 100644 --- a/tests.py +++ b/tests.py @@ -11,7 +11,6 @@ from subprocess import Popen, PIPE from tempfile import TemporaryDirectory from multiprocessing.dummy import Pool -from memory_profiler import profile as profile_memory sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) @@ -31,6 +30,8 @@ from functools import wraps PROFILE_MEMORY = os.environ.get("PROFILE_MEMORY", False) +if PROFILE_MEMORY: + from memory_profiler import profile as profile_memory try: subprocess.call(