Generate coverage information for Vim scripts.
Project description
covimerage
Generates code coverage information for Vim scripts.
It parses the output from Vim's :profile
command, and generates data
compatible with Coverage.py.
Installation
You can install covimerage using pip:
pip install covimerage
Simple usage
You can use covimerage run
to wrap the call to Neovim/Vim with necessary
boilerplate:
covimerage run vim -Nu test/vimrc -c 'Vader! test/**'
This will write the file .coverage_covimerage
by default (use --data-file
to configure it), which is compatible with Coverage.py.
A report is automatically generated (on stdout).
You can then call covimerage xml
to create a coverage.xml
file
(Cobertura-compatible), which tools like Codecov's
codecov
tool can consume, e.g. via codecov -f coverage.xml
.
Manual/advanced usage
1. Generate profile information for your Vim script(s)
You have to basically add the following to your tests vimrc:
profile start /tmp/vim-profile.txt
profile! file ./*
This makes Neovim/Vim then write a file with profiling information.
2. Call covimerage on the output file(s)
covimerage write_coverage /tmp/vim-profile.txt
This will create a file .coverage_covimerage
(the default for --data-file
),
with entries marked for processing by a
Coverage.py plugin (provided by
covimerage)).
3. Include the covimerage plugin in .coveragerc
When using coverage
on the generated output (data file), you need to add
the covimerage
plugin to the .coveragerc
file (which Coverage.py uses).
This is basically all the .coveragerc
you will need, but you could use
other settings here (for Coverage.py), e.g. to omit some files:
[run]
plugins = covimerage
data_file = .coverage_covimerage
4. Create the report(s)
You can now call e.g. coverage report -m
, and you should be able to use
coverage reporting platforms like https://codecov.io/ or
https://coveralls.io, which are basically using coverage xml
.
Reference implementation
-
Neomake is the first adopter of this. It has an advanced test setup (including Docker based builds), and looking at tis setup could be helpful when setting up covimerage for your plugin/project.
- Neomake's coverage report on codecov.io
- PR/change to integrate it in Neomake (Neomake's test setup is rather advanced, so do not let that scare you!)
Links
- Discussion in Coverage.py's issue tracker: coverage issue 607
TODO
- Line hit counts: known to covimerage, but not supported by Coverage.py (https://bitbucket.org/ned/coveragepy/issues/607/#comment-40048034).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file covimerage-0.1.7.tar.gz
.
File metadata
- Download URL: covimerage-0.1.7.tar.gz
- Upload date:
- Size: 34.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdde174fc467eccab1322935ec9549c9897a2c2d56587ab8cb3fb806a52d0449 |
|
MD5 | 31c650ba5fbb4fdba36acf0b32274fb0 |
|
BLAKE2b-256 | fb733f5035421bfe1837043a89647847611619c81bf78f95a724fe85fd0bc1bb |
File details
Details for the file covimerage-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: covimerage-0.1.7-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9be5b7b171d90c72153cd8381f0b819b8e6b665fb3db2db6f23027112c36fe0b |
|
MD5 | 424ff490bc32d2ec71d893d62b5c8f30 |
|
BLAKE2b-256 | bd1689bd49d632b2a32c1a7520a55832e70e49284ee6ebdb14266d2b4da449b3 |