vscode-python-test-adapter
vscode-python-test-adapter copied to clipboard
Hierarchical grouping
Hello, It is a way to have a deeper than two level hierarchy in the explorer? For instance something as Folder as top root, File Name as second level, Class name as third level, and unit test as fourth level.
Best, Tommaso
@TommasoBendinelli Thank you for the issue! I will consider some options, but I believe, it can lead to a lot of unnecessary levels. What kind of framework are you using? And if it is possible, please, provide an example of your directory structure.
Hello, I am using a unittest and I am working with a project that consist of three modules: a model, an algorithm to control that model and a visualisation tool to visualise the results. So I subdivided my test folder in three subfolder (model, algorithm and visualisation tool). The test exploring interface is a bit confusing because I have so many tests, and with a first sub group with folders would be really helpful
This issue is very pronounced when using pytest.
With pytest, the label
appears to be the directory of the test module. For long test module names, the tree view will truncate the label so unless you have globally unique test module names it can be impossible to determine which package you are looking at. The default view in the native vscode testing tree is to group by directory/package.
++ to this. The proposed feature is crucial to me, especially for the parametrized pytest units. The general Python extension already handles it, but with this extension what I see is as below, which is outright unusable.
@meakbiyik Thanks for reporting this. I believe it's slightly different from the original issue and kind of easier to resolve. I've just published a new version 0.6.6 that will group parameterized tests under a suite node. Please, update and let me know how it works for you.
About the test hierarchy for files, I'm trying to experiment a bit, but it will be helpful if anyone can show real-world examples of file structure and a desired tree in the Test Explorer.
@kondratyev-nv works perfectly, thanks! Time to add this extension to the recommended ones in vscode 😃
I still think it would be great to organize tests by their folder hierarchy. I have a tests
directory with subfolders unit
, integration
and system
. It would be super useful to be able to start only one of the test types separately. I would be willing to submit a PR if you could point me into the right direction.
@meakbiyik Thanks for reporting this. I believe it's slightly different from the original issue and kind of easier to resolve. I've just published a new version 0.6.6 that will group parameterized tests under a suite node. Please, update and let me know how it works for you.
About the test hierarchy for files, I'm trying to experiment a bit, but it will be helpful if anyone can show real-world examples of file structure and a desired tree in the Test Explorer.
What is a suite node
? An example would be greatly appreciated!
Note that such a hierarchical grouping per directory would also solve #228.
My real-world example is GraphQL-core where the tests are separate, but grouped in sub-packages for each sub-packages they are testing. The native Python test runner shows the file level hierarchy I would expect.