pytest-cov Questions

8

Solved

I've got a file in the package with 'test' in its name and when I run pytest I got an error import file mismatch: imported module 'my_project.my_file_test' has this __file__ attribute: /my_proje...
Tailback asked 24/12, 2018 at 22:25

2

I have 2 files in my project (a.py and b.py). a.py file is imported in the unit test file (test_prog.py) and there are tests written for it. Pytest-cov shows the coverage for this file. However fo...
Singlehearted asked 26/5, 2020 at 8:50

2

Solved

I'm trying to make it so that when I run my test in test explorer it will automatically generate a cov.xml file at the same time in the project folder. Ive tried adding in the arguments to the pyte...
Telson asked 4/10, 2021 at 22:57

1

When I run my tests, I realised that pytest-cov only shows coverage reports for files that are touched during the automated tests. How can I set it so that it shows coverage for even files that are...
Banjermasin asked 7/4, 2022 at 9:14

1

Solved

The documentation of coverage.py says that Many people choose to use the pytest-cov plugin, but for most purposes, it is unnecessary. So I would like to know what is the difference between these tw...
Chou asked 7/3, 2022 at 10:59

3

sample.py def sum(num1, num2): return num1 + num2 def sum_only_positive(num1, num2): if num1 > 0 and num2 > 0: return num1 + num2 else: return None test_sample.py from . import sample...
Infatuate asked 20/3, 2020 at 15:7

1

I am using tox to run tests on different envs using tox -p(run in parallel), but have a problem with coverage report generation for all tests. tox.ini: [tox] envlist = env1,ev2,report skipsdist=Tru...
Effort asked 10/12, 2021 at 18:4

2

Solved

Context I am updating an inherited repository which has poor test coverage. The repo itself is a pytest plugin. I've changed the repo to use tox along with pytest-cov, and converted the "raw&q...
Billion asked 5/6, 2020 at 18:5

1

Solved

I'm trying to add a code coverage % badge to my repos README.md I'm currently using Github actions to automate my pytest testing. I had that working on its own, but ive been struggling trying to ge...
Interfaith asked 29/3, 2020 at 6:12

1

Solved

Background I'm new to using pytest and pytest-cov having switched over from unittest + coverage.py I first set up my automated tests to run in this way: python3 -m pytest --cov=myapplication which ...
Parsaye asked 19/2, 2021 at 15:32

1

Solved

I am testing my code with pytest --cov but one of my modules gets 0% coverage. The module has one class declaration as such: class DataBaseMaker: @staticmethod def create_database(): conn = sqli...
Guerra asked 10/2, 2021 at 22:19

2

Solved

I'm running pytest with the coverage plugin (pytest --cov) and in the report I got the following line: Name Stmts Miss Branch BrPart Cover Missing --------------------------------------------------...
Keelung asked 17/10, 2020 at 20:20

1

Solved

Pytest cov is not reading its setting from the pyproject.toml file. I am using nox, so I run the test with: python3 -m nox It seems I have the same issue even without nox. In fact, after running a...
Purington asked 9/7, 2020 at 22:39

1

In pytest-cov documentation it says: Note that this plugin controls some options and setting the option in the config file will have no effect. These include specifying source to be measured (...
Fug asked 12/5, 2020 at 18:15

0

I simply do not understand the output from pytest-cov My test module is the following from starlette.testclient import TestClient def test_ping(test_app: TestClient): response = test_app.get...
Grannie asked 8/6, 2020 at 15:29

1

Solved

I run my unit tests via pytest. For coverage I use coverage.py. In one of my unit tests, I run a function via multirpocessing and the coverage does not reflect the functions running via multirpoce...
Indefinable asked 10/4, 2020 at 15:50

1

Solved

I'm trying to get coverage using trace.py when running pytest. I know that pytest has its own coverage plugin pytest-cov but restrictions (number of times each line is executed is unavailable) do n...
Lambda asked 11/12, 2017 at 6:50

1

Having trouble getting this implementation down. What I need: Code coverage results on my existing flask application, preferably using unit tests compatible with pytest. What I am seeing: I am se...
Somnifacient asked 30/10, 2019 at 17:45

2

Solved

I'm learning about testing in Python, and now I'm using pytest-cov. I try to run this command: pytest --cov=myProj tests/ --cov-report term-missing after the testing done I got the report lik...
Tyrocidine asked 22/3, 2019 at 5:3

1

Solved

I'm trying to setup codecov on my public travis repo and so far haven't been able to successfully generate a report and upload it to codecov.io. I appear to receive an erroneous report in terminal ...
Argybargy asked 8/12, 2018 at 5:24

2

Solved

I have a Python project that uses pytest-cov for unit testing and code coverage measurement. The directory structure for my project is: rift-python +- rift # The package under test | +- __init__....
Isobel asked 2/8, 2018 at 22:19

1

Solved

I am getting ImportError: No module named _pluggy error when running tests using pytest. Then I tried installing pluggy using pip install pluggy. It installs pluggy==0.6.0 successfully, but is st...
Kiangsi asked 19/12, 2017 at 10:18
1

© 2022 - 2024 — McMap. All rights reserved.