Repository navigation
Find a Windows virtualenv at .venv\Scripts\python.exe - #7
Open
dieterstemmet wants to merge 2 commits into
Open
dieterstemmet wants to merge 2 commits into
dieterstemmet wants to merge 2 commits into
Conversation
Why: on Windows a venv keeps its interpreter in Scripts\python.exe, not bin/python. The lookup missed it, fell back to python3, and ran the tests without the project's packages, so every function scored 0% coverage. What: _python_executable also checks .venv/Scripts/python.exe and venv/Scripts/python.exe, after the bin/python paths. Proof: test_python_executable_finds_a_windows_venv failed first (got python3), then passed. On a copy of dryer with its own venv, crapper ran 80 passing tests under .venv\Scripts\python.exe and reported real coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On Windows a venv keeps its interpreter in
Scripts\python.exe, notbin/python._python_executablechecks only thebin/pythonpaths. On Windows it misses the project's venv and falls back topython3, which runs the tests without the project's packages. The tests then fail, and every function scores 0% coverage.What
_python_executablealso checks.venv/Scripts/python.exeandvenv/Scripts/python.exe, after the existingbin/pythonpaths. Unix lookup order is unchanged.Not included
Three tests in the suite fail on Windows before and after this change. All three come from Unix assumptions in the tests, not in crapper:
test_project_snapshot_is_readable_as_crap4clj_ednruns a shell script directly.test_uml_loader_rejects_a_missing_viewerruns the zshumlloader.test_files_outside_the_project_keep_an_absolute_pathcompares a/path with a\path.I can send fixes for these separately if you want them.
Verified
test_python_executable_finds_a_windows_venvfailed first (gotpython3), then passed..venv\Scripts\python.exeand reported real coverage.test_project_snapshot_is_readable_as_crap4clj_ednandtest_uml_loader_rejects_a_missing_viewer, because that box has nozshorclj.