Repository navigation
Pytest Report fails due to AttributeError #21784
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Aug 8, 2023 - changed the title
[-]Pytest Report failes due to AttributeError[/-][+]Pytest Report fails due to AttributeError[/+]on Aug 8, 2023 Jon Marston (@johnmarston-nhs) What is the version of
pytestthat you have?- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 8, 2023 - addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugand removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 8, 2023 johnmarston-nhs commented
on Aug 8, 2023 AuthorMore actionsKarthik Nadig (@karthiknadig) 6.2.5.
Just to add to this, it works fine if I pin the version of vscode-python to 2023.12.0.
Thank you for your issue report. If you add this to your settings does this fix it? user settings:
"python.experiments.optOutFrom": ["pythonTestAdapter"],. If that does fix it then it is likely on the rewrite which will give me more information I can use to fix this. Thanks- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 9, 2023 johnmarston-nhs commented
on Aug 9, 2023 AuthorMore actionsHi Eleanor Boyd (@eleanorjboyd) , yes, opting out from
pythonTestAdapterfixes the issue, thank you for your suggestion. Is leaving this disabled gonna bite me in the butt later down the line? 😄As an addition, I was looking into the exception - it seems to be down to the
CollectReportclass not being 'exported' in versions of pytest below v7. It got added in this commit: pytest-dev/pytest@b0aa870Maybe you can work around this with a
str()around the call totype()or something, as I think pytest 6 is still quite widely used.- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Aug 9, 2023 Thank you for that investigation! I will look into that as a workaround.
Also no, the setting shouldn't be a problem later as once we are fully confident in the re-write and move it to 100% of stable we will get rid of the experiment and that setting will be ignored.
Reacted by Jon Marston- addedneeds PRReady to be worked onReady to be worked onand removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Aug 11, 2023 3 remaining items
- addedverification-neededVerification of issue is requestedVerification of issue is requested
on Aug 28, 2023 - addedverification-steps-neededSteps to verify are needed for verificationSteps to verify are needed for verification
on Aug 29, 2023 Are there verification steps? Or Jon Marston (@johnmarston-nhs), do you still see this in the latest Python prerelease?
- set your pytest version to 6.2.5
- create a test in a file like
test_file.py
def test_a: assert True- run pytest discovery (testing tab, configure testing with pytest)
- run this pytest test
- confirm you do not see any errors like above in your "python testing log" section of the output panel
- removedverification-steps-neededSteps to verify are needed for verificationSteps to verify are needed for verification
on Aug 29, 2023 - addedverifiedVerification succeededVerification succeeded
on Aug 30, 2023 To verify I have to update the above sample to following
def test_a(): assert TrueI am running pytest 6.2.5, and I am seeing the error even with the
"python.experiments.optOutFrom": ["pythonTestAdapter"],setting configured in my user settings.to confirm Wil Collins (@collinwr) you are seeing
INTERNALERROR> AttributeError: module 'pytest' has no attribute 'CollectReport'right? Do you see this even when you opt into the experiment? It will currently only work on insiders as this is unreleased in stable.- locked as resolved and limited conversation to collaborators
on Oct 6, 2023
Type: Bug
Behaviour
Expected vs. Actual
Expected behaviour:
When a test fails, the pytest report should be printed to the terminal.
Actual:
INTERNALERROR is reported to the terminal, along with a stacktrace as follows:
Steps to reproduce:
Diagnostic data
python.languageServersetting: DefaultOutput for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)User Settings
Extension version: 2023.14.0
VS Code version: Code 1.81.0 (6445d93c81ebe42c4cbd7a60712e0b17d9463e97, 2023-08-02T12:36:11.334Z)
OS version: Linux x64 6.4.7-200.fc38.x86_64
Modes:
System Info
canvas_oop_rasterization: disabled_off
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: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
A/B Experiments