File do-not-reset-pythonpath.patch of Package python-line_profiler
From 471c275efd1861879f488abf750199e6de8995f9 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Wed, 8 Apr 2026 15:51:41 +1000
Subject: [PATCH] Do not explicitly reset PYTHONPATH for two tests
Two testcases in test_explicit_profile explicitly reset PYTHONPATH to
just the current working directory, whereas other testcases in the same
file make sure to respect the existing PYTHONPATH.
---
tests/test_explicit_profile.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test_explicit_profile.py b/tests/test_explicit_profile.py
index 1a5b2a7c..f7ecd787 100644
--- a/tests/test_explicit_profile.py
+++ b/tests/test_explicit_profile.py
@@ -153,7 +153,7 @@ def test_explicit_profile_ignores_inherited_owner_marker():
env = os.environ.copy()
env['LINE_PROFILE'] = '1'
env['LINE_PROFILER_OWNER_PID'] = str(os.getpid() + 100000)
- env['PYTHONPATH'] = os.getcwd()
+ env['PYTHONPATH'] = f"{os.getcwd()}:{env['PYTHONPATH']}"
with ub.ChDir(temp_dpath):
script_fpath = ub.Path('script.py')
@@ -182,7 +182,7 @@ def test_explicit_profile_process_pool_forkserver():
env = os.environ.copy()
env['LINE_PROFILE'] = '1'
# env['LINE_PROFILER_DEBUG'] = '1'
- env['PYTHONPATH'] = os.getcwd()
+ env['PYTHONPATH'] = f"{os.getcwd()}:{env['PYTHONPATH']}"
with ub.ChDir(temp_dpath):
script_fpath = ub.Path('script.py')