Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python unit tests cannot be executed #738

Open
sleepyhollo opened this issue Jul 3, 2023 · 3 comments
Open

Python unit tests cannot be executed #738

sleepyhollo opened this issue Jul 3, 2023 · 3 comments

Comments

@sleepyhollo
Copy link

sleepyhollo commented Jul 3, 2023

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:

  1. Monkey patching that file to use python instead of python3
  2. 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

@codeinabox
Copy link
Collaborator

What version of Python do you have installed and what Python test runner are you using?

@codeinabox
Copy link
Collaborator

I've added logic #750 to detect the Python executable, so could you please update the plugin and try again

@codeinabox
Copy link
Collaborator

Hello @sleepyhollo, could you please let me know if the latest version of vim-test fixes this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants