pytest-dev/pytest-cov là dự án Backend trên GitHub, viết chủ yếu bằng Python, với 2.1k sao. Coverage plugin for pytest.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This plugin provides coverage functionality as a pytest plugin. Compared to just using coverage run this plugin does some extras:
Automatic erasing and combination of .coverage files and default reporting.
Support for detailed coverage contexts (add --cov-context=test to have the full test name including parametrization as the context).
Xdist support: you can use all of pytest-xdist's features including remote interpreters and still get coverage.
Consistent pytest behavior. If you run coverage run -m pytest you will have slightly different sys.path (CWD will be
in it, unlike when running pytest).
All features offered by the coverage package should work, either through pytest-cov's command line options or
through coverage's config file.
Free software: MIT license
Installation
Install with pip::
pip install pytest-cov
For distributed testing support install pytest-xdist::
pip install pytest-xdist
Migrating from coverage.py
coverage run -m pytest and pytest --cov do not necessarily import code the same way. The former starts pytest with
python -m, which adds the current working directory to sys.path. The latter uses the pytest command, which does
not add it automatically. If coverage drops unexpectedly after switching, check that the package under test is installed
in your environment (for example, with pip install -e .) rather than relying on the working directory being importable.
Run pytest --cov=myproj tests/ from the same environment to confirm that tests still import your package.
For subprocess coverage, pytest-cov 7 no longer installs the .pth file used by earlier releases; see
Upgrading from pytest-cov 6.3_ below for the replacement.
Upgrading from pytest-cov 6.3
pytest-cov 6.3 and older were using a .pth file to enable coverage measurements in subprocesses. This was removed in pytest-cov 7 - use coverage's patch options <https://coverage.readthedocs.io/en/latest/config.html#run-patch>_ to enable subprocess measurements.
Uninstalling
Uninstall with pip::
pip uninstall pytest-cov
Under certain scenarios a stray .pth file may be left around in site-packages.
pytest-cov 2.0 may leave a pytest-cov.pth if you installed without wheels
(easy_install, setup.py install etc).
pytest-cov 1.8 or older will leave a init_cov_core.pth.
Usage
::
pytest --cov=myproj tests/
Would produce a report like::
-------------------- coverage: ... ---------------------
Name Stmts Miss Cover
----------------------------------------
myproj/__init__ 2 0 100%
myproj/myproj 257 13 94%
myproj/feature4286 94 7 92%
----------------------------------------
TOTAL 353 20 94%
Documentation
https://pytest-cov.readthedocs.io/en/latest/
Coverage Data File
The data file is erased at the beginning of testing to ensure clean data for each test run. If you
need to combine the coverage of several test runs you can use the --cov-append option to append
this coverage data to coverage data from previous test runs.
The data file is left at the end of testing so that it is possible to use normal coverage tools to
examine it.
Limitations
For distributed testing the workers must have the pytest-cov package installed. This is needed since
the plugin must be registered through setuptools for pytest to start the plugin on the
worker.
Security
To report a security vulnerability please use the Tidelift security contact <https://tidelift.com/security>_.
Tidelift will coordinate the fix and disclosure.
Acknowledgements
Whilst this plugin has been built fresh from the ground up it has been influenced by the work done
on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are
other coverage plugins.
Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs.
Holger Krekel for pytest with its distributed testing support.
Jason Pellerin for nose.
Michael Foord for unittest2.
No doubt others have contributed to these tools as well.
pytest-dev/pytest-cov có 2.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/pytest-dev/pytest-cov. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
pytest-dev/pytest-cov có những chủ đề gì?
GitHub topics của pytest-dev/pytest-cov: "pytest", "python". TopGit xếp repo vào nhóm Backend.
pytest-dev/pytest-cov còn đang phát triển không?
Commit gần nhất trên pytest-dev/pytest-cov là 1 tháng trước (theo timestamp GitHub). Repo có 259 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
pytest-dev/pytest-cov là gì?
pytest-dev/pytest-cov (pytest-dev/pytest-cov) là dự án Python trên GitHub. Theo mô tả gốc: Coverage plugin for pytest.
pytest-dev/pytest-cov so với các dự án Backend khác thế nào?
pytest-dev/pytest-cov được TopGit xếp vào nhóm Backend, với 2.1k sao GitHub và viết bằng Python. Xem trang chủ đề Backend trên TopGit để so sánh với các dự án tương tự theo số sao và mức độ hoạt động.
pytest-dev/pytest-cov viết bằng ngôn ngữ gì?
pytest-dev/pytest-cov chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao pytest-dev/pytest-cov được xếp vào nhóm Backend?
TopGit xếp pytest-dev/pytest-cov vào nhóm Backend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "pytest", "python"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về pytest-cov?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về pytest-cov.