Skip to content

Commit 492a8c4

Browse files
Do not explicitly reset PYTHONPATH for two tests (#430)
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.
1 parent 3dd2008 commit 492a8c4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/test_explicit_profile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ def test_explicit_profile_ignores_inherited_owner_marker():
153153
env = os.environ.copy()
154154
env['LINE_PROFILE'] = '1'
155155
env['LINE_PROFILER_OWNER_PID'] = str(os.getpid() + 100000)
156-
env['PYTHONPATH'] = os.getcwd()
156+
env['PYTHONPATH'] = os.pathsep.join(
157+
[p for p in [os.getcwd(), env.get('PYTHONPATH')] if p]
158+
)
157159

158160
with ub.ChDir(temp_dpath):
159161
script_fpath = ub.Path('script.py')
@@ -182,7 +184,9 @@ def test_explicit_profile_process_pool_forkserver():
182184
env = os.environ.copy()
183185
env['LINE_PROFILE'] = '1'
184186
# env['LINE_PROFILER_DEBUG'] = '1'
185-
env['PYTHONPATH'] = os.getcwd()
187+
env['PYTHONPATH'] = os.pathsep.join(
188+
[p for p in [os.getcwd(), env.get('PYTHONPATH')] if p]
189+
)
186190

187191
with ub.ChDir(temp_dpath):
188192
script_fpath = ub.Path('script.py')

0 commit comments

Comments
 (0)