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

No test under python unittest in visual studio 2019 #5968

Closed
vsfeedback opened this issue Jan 13, 2020 · 0 comments · Fixed by #5971
Closed

No test under python unittest in visual studio 2019 #5968

vsfeedback opened this issue Jan 13, 2020 · 0 comments · Fixed by #5971
Assignees
Labels

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


I have an existing python project in visual studio 2019 (Version16.3.9) containing unit test created for unittest.py under visual studio 2017. I already configered the project for unittest, because this is needed in visual studio 2019. But there are no unit tests shown.

I got the following error in Output-Pane:

File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\run_adapter.py", line 17, in <module>
    tool, cmd, subargs, toolargs = parse_args()
  File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\adapter\__main__.py", line 81, in parse_args
    subsub = add_subparser(cmdname, toolname, subsubs)
  File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\adapter\__main__.py", line 26, in pytest_add_cli_subparser
    from . import pytest
  File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\adapter\pytest\__init__.py", line 7, in <module>
    from ._discovery import discover
  File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\adapter\pytest\_discovery.py", line 31, in <module>
    patch_translate_non_printable()
  File "C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\adapter\pytest\_discovery.py", line 15, in patch_translate_non_printable
    translate_non_printable =  getattr(_pytest.compat, "_translate_non_printable")
AttributeError: module '_pytest.compat' has no attribute '_translate_non_printable'

Whole Test-Output is attached.


Original Comments

Visual Studio Feedback System on 11/25/2019, 02:09 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Alexander Jäger on 11/25/2019, 11:33 PM:

When opening the same solution in Visual Studio 2017 (15.9.17) all the tests are shown and can be run.

Visual Studio Feedback System on 1/2/2020, 05:34 PM:

I have detected that for the last 35 days, this issue didn't have much product team activity and a very small amount of new votes or comments. Based on this, its severity, and affected area, it’s my experience that this issue is very unlikely to be fixed.

Bill Schnurr [MSFT] on 1/13/2020, 02:42 PM:

It appears you have pytest installed which is missing _pytest.compat.

If you only want to run unittest i suggest uninstalling pytest from your environment, or try updating to a newer version of pytest that includes _pytest.compat

Thank you

Bill Schnurr [MSFT] on 1/13/2020, 03:00 PM:

sorry I was mistaken. Your version of pytest does have "_pytest.compat" but what its missing is pytest.compat._translate_non_printable. Perhaps its an older version of pytest?

I'll update our script to handle this error better.

Thank you


Original Solutions

(no solutions)

@bschnurr bschnurr added this to the January 2020.2 milestone Jan 13, 2020
@bschnurr bschnurr self-assigned this Jan 13, 2020
bschnurr added a commit to bschnurr/PTVS that referenced this issue Jan 14, 2020
bschnurr added a commit that referenced this issue Jan 14, 2020
…ting error instead of throwing AttributeError (#5971)

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

Successfully merging a pull request may close this issue.

2 participants