Coder Social home page Coder Social logo

Comments (13)

kondratyev-nv avatar kondratyev-nv commented on June 15, 2024 3

@arjntc1 I've just published a new version 0.3.14 with the fix that will allow you to go to the source for most cases. Please, update and let me know if the issue persists.

from vscode-python-test-adapter.

kondratyev-nv avatar kondratyev-nv commented on June 15, 2024

@arjntc1 Thank you for the issue! However, such functionality comes from Test Explorer UI, see https://github.com/hbenl/vscode-test-explorer which is used as the UI provider for various test adapters. Still, I think that this might be an excellent enhancement. Thus I will create a similar issue to Test Explorer UI repository.

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

I'm familiar with the Test Explorer UI from that repo (that one does support deep linking). The UI for the tests with this extension is the one that does not seem to support it (I might be missing a configuration?). Single clicking opens up the output window (if used), but no way to link to the code itself.

from vscode-python-test-adapter.

AlexHaxe avatar AlexHaxe commented on June 15, 2024

I guess your test-adapter is not reporting line numbers for individual test methods, that way test explorer cannot link to your file (e.g. no "Show Source" button), and there will be no code lens or gutter annotations (for a sample see https://github.com/vshaxe/haxe-test-adapter/blob/master/images/demo.gif)

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

Hey Alex -- no, I don't see the same view (or the ability to run tests from the sidebar -- not sure if that is haxe test extension specific). When I click a test, I can see the output window (but it does not go to the appropriate test method. I have to search for the method in the test file. Am I missing a configuration setting?

from vscode-python-test-adapter.

AlexHaxe avatar AlexHaxe commented on June 15, 2024

"Haxe Test Explorer" extension itself has no UI, so all test related UI elements you see in that .gif come from "Test Explorer UI" extension. Haxe's test adapter (like all other test adapters) is simply a data collecting and converting extension, it collects test results and passes them on to "Test Explorer UI" for display. It also implements run and debug methods so that "Test Explorer UI" can launch test runs with optional filtering (as shown in demo.gif).

I haven't looked into "Python Test Adapter", I assume it performs a similar job. I guess it needs some improvement to what data is collected and how it is passed on, so that all features of "Test Explorer UI" become available.

from vscode-python-test-adapter.

kondratyev-nv avatar kondratyev-nv commented on June 15, 2024

@arjntc1 Maybe there is some other problem with the test discovery? There should be a button on the right of your test modules and methods with the "Show source" tooltip. Clicking it will open a file on the line where test method is located. See the following gif for example.
python-go-to-source
There might be some issues with detecting line numbers, but I guess it should be considered as an other issue with more specific information on your tests and environment.

Also, I looked through the code of Test Explorer UI and I don't see any way to navigate to the test source other than described above. Opening the Output panel is an expected behavior for completed tests. In fact, I don't see any way to add double-click actions from the TreeView items of VSCode itself.

I think some screenshot or a more detailed description of what you see and what you expect would be of help.

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

Thanks @AlexHaxe for the explanation -- I didn't know that. @kondratyev-nv -- I don't see the third icon to open the source file. I only see the debug and run icons.

from vscode-python-test-adapter.

kondratyev-nv avatar kondratyev-nv commented on June 15, 2024

@arjntc1 Ok, I see. Then it looks like there is some issues with discovering test files and method line numbers. Can you tell more about your environment. What OS do you have? Which Python version do you use? What test framework (and what version) do you use? Do you see your files/classes correctly in the Test Explorer Panel?

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

OS: Ubuntu 18.04 LTS
Python Version: Python 3.7.4 (using virtualenv for virtual environment)
VS Code: 1.39.1
Test Framework: Unittest
Linting: Pylint/Pylama

I do see files/classes correctly in the Test Explorer Panel. Discover/run works with no problem.

from vscode-python-test-adapter.

kondratyev-nv avatar kondratyev-nv commented on June 15, 2024

@arjntc1 Thank you for the information. Indeed, I can confirm that line numbers for unittest tests are not detected. Thus I renamed the issue. Some time ago, there was a fallback within Test Explorer UI for such cases, but I guess it was removed. I will try to add line number detection for unittest tests.

As a quick fix, I can propose using pytest, see https://docs.pytest.org/en/latest/unittest.html. It is compatible with unittest tests, and line number detection already works.

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

Thanks @kondratyev-nv! I actually didn't expect movement so quickly. Thanks for looking into this!! I will look into using pytest to run unittest tests. I didn't know that it could do that. Thanks for the link.

from vscode-python-test-adapter.

arjntc1 avatar arjntc1 commented on June 15, 2024

This is amazing! Thanks @kondratyev-nv !! When I mentioned it a few days ago, I did not expect the great communication on the issue or a fix before the week is out. I just tested the latest version (0.3.14) -- it works great! I see the third icon and can go right to the source within the Test Explorer! Thanks again!

from vscode-python-test-adapter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.