Python unit tests cannot be executed
sleepyhollo opened this issue · comments
Bug Report
Current Behavior
Attempting a run a python test with vim-test fails with "python not found" error
Expected Behavior
Vim-test should be able to run the test.
Additional context/output
"python3 -m unittest tests.NAME_OF_TEST"
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
shell returned 9009
Press ENTER or type command to continue
Possible Solution
Maybe the issue is in the pyunit.vim file (here)). The plugin tries to use python3 when running the UTs in windows; apparently, windows does not have python3 support (stackoverflow answer).
Two solution approaches come to mind:
- Monkey patching that file to use python instead of python3
- adding a batch file accessible to path that links python3 to python. Note that the batch file should be accessible before window system files, otherwise it may start the windows app store when you run python3. Specifically, this means the path to where the batch file should be before the system paths in the environments PATH variable.
System details
Windows version: 10
OS architecture: 64 bit
PowerShell version: 5.1.19041.3031
Additional software: I am having this problem when i am running vim from command prompt using the Windows Terminal Preview SW. However, the issue also happens with CMD
What version of Python do you have installed and what Python test runner are you using?
I've added logic #750 to detect the Python executable, so could you please update the plugin and try again