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

could not make test explorer work #22396

Closed
chanansh opened this issue Oct 31, 2023 · 4 comments
Closed

could not make test explorer work #22396

chanansh opened this issue Oct 31, 2023 · 4 comments
Assignees
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@chanansh
Copy link

Type: Bug

Why is it so hard to make test explorer work with pytest?
I have simple project structure

project_root/
   src/
   tests/

my settings are:

{
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    "python.analysis.autoImportCompletions": true,
    "python.analysis.extraPaths": [
        "src", "tests"
    ],
    "python.testing.nosetestsEnabled": false,
}

VS Code version: Code 1.83.1 (Universal) (f1b07bd25dfad64b0167beb15359ae573aecd2cc, 2023-10-10T23:46:55.789Z)
OS version: Darwin arm64 22.6.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (8 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 5, 5, 6
Memory (System) 16.00GB (0.14GB free)
Process Argv --crash-reporter-id ddfe9aff-4573-4a0c-bd0f-c0565eb393f5
Screen Reader no
VM 0%
Extensions (20)
Extension Author (truncated) Version
codeium Cod 1.4.5
vscode-test-explorer hbe 2.21.1
vscode-python-test-adapter lit 0.8.1
rainbow-csv mec 3.8.0
git-graph mhu 1.30.0
black-formatter ms- 2023.4.1
mypy-type-checker ms- 2023.4.0
python ms- 2023.18.0
vscode-pylance ms- 2023.10.50
jupyter ms- 2023.9.1102792234
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.17
vscode-jupyter-cell-tags ms- 0.1.8
vscode-jupyter-slideshow ms- 0.1.5
makefile-tools ms- 0.7.0
test-adapter-converter ms- 0.1.8
vsliveshare ms- 1.0.5892
autodocstring njp 0.6.1
intellicode-api-usage-examples Vis 0.2.8
vscodeintellicode Vis 1.2.30
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30856252
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
f6dab269:30613381
vscrp:30673768
2i9eh265:30646982
showlangstatbar:30737416
962ge761:30841074
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
copilotsettingc:30859502
dsvsc013:30795093
dsvsc014:30804076
pythonmhint1:30842940
dsvsc015:30845448
pythontestfixtcf:30871695
pythonregdiag2:30871582
pyreplss1:30865275
pythoncet0:30874138
2e7ec940:30870395
pythontbext0cf:30864173

@eleanorjboyd
Copy link
Member

Hello! Sorry to hear it isn't working out of the box! Could you include a layout of your project and your logs from the python output channel? For your logs, can you first set your log level to trace via theDeveloper: set log level command in the command palette? With these I can better help figure out what might be going wrong. Thanks

@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode Oct 31, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 31, 2023
@eleanorjboyd
Copy link
Member

Closing as this issue has been inactive for over a month and requires information from the poster. Please comment with the required information if this is not resolved and I can reopen. Thanks

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 6, 2023
@chanansh
Copy link
Author

chanansh commented Dec 7, 2023

I found the solution was to add this to the pyproject.toml

[tool.pytest.ini_options]
pythonpath = "src"
addopts = "-s"

make sense one could indicate in vs code what is the code root (in my case src) so that the pythonpath includes it (like in PyCharm)

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Dec 7, 2023
@eleanorjboyd
Copy link
Member

@chanansh, glad you found a fix! We are moving to having a more obvious way to set env vars, do you think something like this would have made this more discoverable as a user? #21845

Curious on any input you have that might have made setting this up go smoother as we are always trying to improve this experience, let me know if you have any thoughts

Thanks!

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants