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

Does not recognize the results of the second test module. #465

Open
fargoss opened this issue Jan 18, 2025 · 1 comment
Open

Does not recognize the results of the second test module. #465

fargoss opened this issue Jan 18, 2025 · 1 comment

Comments

@fargoss
Copy link

fargoss commented Jan 18, 2025

Describe the bug
Does not recognize the results of the second test module.

To Reproduce

Directory structure:

myproject/
├── foobar1/
│   ├── module1.py
│   └── module2.py
├── foobar2/
│   ├── module3.py
│   └── module4.py
└── tests/
    ├── test_module1.py
    └── test_module2.py
    └── test_module3.py
    └── test_module4.py

The following command is used to generate coverage:

pytest tests --cov-report xml:cov.xml --cov foobar1 --cov foobar2

This generates the cov.xml file with the following content:

...
<sources>
	<source>/Users/username/projects/myproject/foobar1</source>
	<source>/Users/username/projects/myproject/foobar2</source>
</sources>
...

In VSCode, modules from foobar1 are highlighted correctly, but modules from foobar2 show "No Coverage."
If the first module is commented out in cov.xml:

<sources>
	<!-- <source>/Users/username/projects/myproject/foobar1</source> -->
	<source>/Users/username/projects/myproject/foobar2</source>
</sources>

Or if the order of the modules is swapped:

<sources>
	<source>/Users/username/projects/myproject/foobar2</source>
	<source>/Users/username/projects/myproject/foobar1</source>
</sources>

Then the coverage results switch—modules from foobar2 are correctly displayed, while modules from foobar1 are not.

Expected behaviour
It is expected that after the tests are run, all modules will be highlighted correctly.

Desktop:

  • OS: MacOs
  • Extension Version 2.12.0
  • VSCode Version 1.96.2
@ryanluker
Copy link
Owner

@fargoss Thanks for the issue!

Hmm could be that the coverage parser library we use doesn't do multiple sources (I bet if you generated 2 coverage files it would work fine).

I believe you are using xml with clover for the coverage file? (we can see here how this logic works)

In the upstream parser repo, I wasn't able to find anything about multiple sources 🤔.
https://github.com/coverage-report/clover-json/blob/master/src/index.js

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

No branches or pull requests

2 participants