-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Wrong module reported when collecting tests in a package #4024
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
Comments
this is an structural mistake when handling non-package folders within packages that contain tests if the folder for a package mismatches, we should have a slash in the module "name" to denote it CC @jonozzz |
Indeed adding
|
@CaselIT thanks for the feedback - we will add a acceptance test in future to sort this out |
…directory when creating modules that are part of a package.
Sorry, I just got back from vacation and just saw this. Why are you looking at the module's name attribute anyway? That should informative only, external code should not rely on that. |
@jonozzz I will try and report back. I'm not directly looking at it. The vscode extension for python parses the collect output to provide the code lens functionality on the test so they can be ran or debugged individually i just noticed that sometimes it was gone and found that the problem was this |
@CaselIT please also report a bug against them, they should run collect-only against a plugin getting the actual objects instead of parsing messy output |
@jonozzz yes it seems to fix the issue and does not break the parser of vscode. Thanks! The reported output is now
|
Is this fixed already?
is the output today as of head of master, unsure if thats correct or not but it looks OK to me? |
I had honestly forgot about this issue. |
Uh oh!
There was an error while loading. Please reload this page.
When collecting tests from a directory is a package with (has a
__init__.py
file), the wrong module is reported if the files are in a subfolderWith a file structure like
The reported output of pytest is
There is no indication that
foo_test.py
is inside the foldersubfolder
I've created a minimal example: https://github.com/CaselIT/pytest-discovery-bug
This issue prevent the function of the python extension for vscode. https://github.com/Microsoft/vscode-python
The text was updated successfully, but these errors were encountered: