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

I am writing unit test cases for python file using pytest framework #1833

Open
DotNetTechSoln opened this issue Aug 13, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@DotNetTechSoln
Copy link

When I am trying to run the test case i am able to run it.using following command

pytest
In the output I can see this
test_sample.py 100%

When I am trying to run the following command to see whole line coverage

coverage run -m pytest
I am getting below error
Windows fatal exception: access violation
when I hit
coverage html
It is saying no data to report
Even . coverage file is also not generating.
anyone please help me.

@DotNetTechSoln DotNetTechSoln added the bug Something isn't working label Aug 13, 2024
@nedbat
Copy link
Owner

nedbat commented Aug 13, 2024

I suspect this is something to do with having more than one Python installation. For example, take a look at the output of these commands:

$ which pytest
$ which coverage
$ which python

The best practice is to always run python as the command:

$ python -m pip install ....
$ python -m pytest
$ python -m coverage run -m pytest
etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants