Conversation
| raise Exception("Can't find your project :(") | ||
| except ImportError: | ||
| # Step 1: Try the dumbest and simplest thing that could possibly work. | ||
| # Yes, that means importing it. Call the cops, I don't care. |
There was a problem hiding this comment.
I've kept this comment as is, but might make sense to rephrase - there was never a step 1 for example.
There was a problem hiding this comment.
Done in a fixup (please squash-merge): it also fixes the sys.path.pop.
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 89.54% 89.59% +0.04%
==========================================
Files 11 11
Lines 440 442 +2
Branches 85 85
==========================================
+ Hits 394 396 +2
Misses 25 25
Partials 21 21
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 89.54% 89.59% +0.04%
==========================================
Files 11 11
Lines 440 442 +2
Branches 85 85
==========================================
+ Hits 394 396 +2
Misses 25 25
Partials 21 21
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 89.49% 89.59% +0.09%
==========================================
Files 11 11
Lines 438 442 +4
Branches 87 85 -2
==========================================
+ Hits 392 396 +4
Misses 25 25
Partials 21 21
Continue to review full report at Codecov.
|
Try importing without changing `sys.path` first. This makes a difference for pytest, where it would fail to `from _pytest._version import version`, since `_pytest._version` does not exist in the source tree (with non-editable installs), but only the installed package. It also improves the error reporting: - prefix with "ERROR" for what might be redirected - raise the `ImportError` directly (more information than when wrapped in `Exception`) Ref: pytest-dev/pytest#6831
2fb1315 to
e9ae9de
Compare
altendky
left a comment
There was a problem hiding this comment.
Would it be reasonable to setup a test for this? It seems like a feature addition so a newsfragment would be useful? Thanks for the help here.
|
If you get back to this before I manage to find some reviews, feel free to merge #297 back in here and we can continue with this PR and close mine. I just didn't want to hijack your branch. Thanks again. |
|
Cool, closing then. |
Try importing without changing
sys.pathfirst.This makes a difference for pytest, where it would fail to
from _pytest._version import version, since_pytest._versiondoesnot exist in the source tree (with non-editable installs), but only
the installed package.
It also improves the error reporting:
ImportErrordirectly (more information than when wrappedin
Exception)Ref: pytest-dev/pytest#6831