Do not explicitly reset PYTHONPATH for two tests#430
Conversation
|
I don't see how this is causing problems. The PYTHONPATH modified is local to these tests, and it does not persist afterward. What is the use case where appending the existing PYTHONPATH is needed? So first you need to convince me that this is needed. If it is, then there are also other issues with the patch. You are assuming a linux environment using the colon as a separator. You should be using os.pathsep. You also assume that PYTHONPATH exists in the dictionary, which it may not. |
|
If line_profiler is not located in the default Our build environment has the module installed in a path that isn't included in |
|
Ok, that makes more sense now. I think something like this will be more robust: env['PYTHONPATH'] = os.pathsep.join(
[p for p in [os.getcwd(), env.get('PYTHONPATH')] if p]
)Make those changes, and I'll run the workflow and merge. |
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.
471c275 to
df3979e
Compare
Done! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #430 +/- ##
==========================================
+ Coverage 87.56% 89.02% +1.45%
==========================================
Files 18 20 +2
Lines 1641 2250 +609
Branches 348 473 +125
==========================================
+ Hits 1437 2003 +566
- Misses 149 184 +35
- Partials 55 63 +8 see 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.