-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Run Tests throws ModuleNotFoundError #16464
Comments
Hi @FelixBenning, thank you for reaching out. Seems like the Can you try starting VS Code from a terminal with the environment already activated? Thank you! |
@kimadeline I assume you mean I should do something like this?
Result is the same
I also tried closing all other instances of vscode and restarting again |
Yep that was it, although clearly it didn't work 🤔 What happens if you run the call that the extension does directly in the terminal? And what is the result of that same call, but without the extension's adapter script: |
I am not sure if that is the right thing - since test discovery also works in vscode
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS D:\code\tf-optimizer-stochastic-runge-kutta> .\env\Scripts\Activate.ps1
(env) PS D:\code\tf-optimizer-stochastic-runge-kutta> python c:\Users\felix\.vscode\extensions\ms-python.python-2021.5.926500501\pythonFiles\testing_tools\run_adapter.py discover pytest -
- --rootdir d:\code\tf-optimizer-stochastic-runge-kutta -s --cache-clear tests
[{"rootid": ".", "root": "D:\\code\\tf-optimizer-stochastic-runge-kutta", "parents": [{"id": "./tests", "kind": "folder", "name": "tests", "parentid": ".", "relpath": ".\\tests"}, {"id":
"./tests/test_basics.py", "kind": "file", "name": "test_basics.py", "parentid": "./tests", "relpath": ".\\tests\\test_basics.py"}], "tests": [{"id": "./tests/test_basics.py::test_optimiza
tion", "name": "test_optimization", "source": ".\\tests\\test_basics.py:7", "markers": [], "parentid": "./tests/test_basics.py"}]}]
(env) PS D:\code\tf-optimizer-stochastic-runge-kutta> code .
(env) PS D:\code\tf-optimizer-stochastic-runge-kutta> (env) PS D:\code\tf-optimizer-stochastic-runge-kutta> python -m pytest --rootdir d:\code\tf-optimizer-stochastic-runge-kutta -s --cache-clear --collect-only tests
================================================================================== test session starts ===================================================================================
platform win32 -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: d:\code\tf-optimizer-stochastic-runge-kutta, configfile: pyproject.toml
collecting ... 2021-06-14 23:30:09.284322: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
collected 1 item
<Module tests/test_basics.py>
<Function test_optimization>
=============================================================================== 1 test collected in 2.95s ================================================================================ |
Oh I see, thank you for the clarification! Could you run the command that appears in the I also have a couple of follow-up questions:
Thanks! |
Hey @FelixBenning,
Even though that shouldn't be needed as running pytest from the terminal works fine. |
@Shourai That workaround with the |
Closing as a duplicate of #14579 |
Reopening as I noticed that all of the referenced issues and PR are closed |
Issue Type: Bug
Run Tests
throws ModuleNotFoundError even though pytest via commandline works andDebug Tests
works fineThe import also works fine in the terminal:
The relevant package is
-e git+git@github.com:FelixBenning/tf-optimizer-stochastic-runge-kutta.git@4908ff6b212a2a3b911ccda5bce995b94a548b6b#egg=SGD_G2
seepip freeze
Extension version: 2021.5.926500501
VS Code version: Code 1.57.0 (b4c1bd0a9b03c749ea011b06c6d2676c8091a70c, 2021-06-09T17:18:42.354Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: