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

Becoming stable #3

Merged
merged 235 commits into from
Oct 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
34208c4
First shot - to be rebased etc
blueyed Sep 18, 2017
c709cd8
clickify, move test_plugin, add test_integration
blueyed Sep 18, 2017
0585751
do not cache tox - we are lightweight
blueyed Sep 18, 2017
0463d1b
RTFM
blueyed Sep 18, 2017
639dbd7
coverage on Travis
blueyed Sep 19, 2017
10e68ef
cli tests
blueyed Sep 19, 2017
4d01d1c
move/cleanup join_script_lines
blueyed Sep 19, 2017
3dcf962
refactor
blueyed Sep 19, 2017
a172b9b
remove empty main
blueyed Sep 19, 2017
5297adf
tox: coverage-py27 for codecov
blueyed Sep 20, 2017
74f4267
cleanup tox/travis
blueyed Sep 20, 2017
78eda40
codecov flag/name
blueyed Sep 20, 2017
53005b8
fixup! clickify, move test_plugin, add test_integration
blueyed Sep 21, 2017
4099064
WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
e8a9880
fixup! WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
d2c854e
fixup! fixup! WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
d718c61
fixup! fixup! fixup! WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
241b30d
fixup! fixup! fixup! fixup! WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
94ee8ab
fixup! fixup! fixup! fixup! fixup! WIP: coveragepy integration, fixes
blueyed Sep 21, 2017
f158f6f
fixup! fixup! fixup! fixup! fixup! fixup! WIP: coveragepy integration…
blueyed Sep 21, 2017
5873758
tox: merge coverage into testenv
blueyed Sep 22, 2017
38e4dfe
Revert "tox: merge coverage into testenv"
blueyed Sep 22, 2017
3f36648
improve tox.ini
blueyed Sep 22, 2017
be5d447
tox: do not allow codecov/coveralls to fail
blueyed Sep 22, 2017
fd52fee
Fix setup.py
blueyed Sep 23, 2017
e06dc78
fixup! RTFM
blueyed Sep 23, 2017
0eb07dd
fixup! RTFM
blueyed Sep 23, 2017
506ce86
Improve logging/verbosity handling
blueyed Sep 23, 2017
e53e9d6
fixup! fixup! RTFM
blueyed Sep 23, 2017
3a92f1c
RFTM love
blueyed Sep 23, 2017
99ac1f3
tests/integration.sh: set -x
blueyed Sep 24, 2017
0608690
README: add codecov badge
blueyed Sep 24, 2017
3ca7d04
compile RE_FUNC_PREFIX
blueyed Sep 24, 2017
c14f2c7
.coveragerc: add source
blueyed Sep 24, 2017
49b9d49
improve tox.ini
blueyed Sep 24, 2017
fc30a90
fix test_cli_call for current click
blueyed Sep 24, 2017
00ceb24
tox: posargs for coverage testenvs
blueyed Sep 24, 2017
87ab102
fix test_cli_call
blueyed Sep 24, 2017
b531d22
fix logging for py27/py36
blueyed Sep 24, 2017
120cea9
fixup! fixup! fixup! fixup! WIP: coveragepy integration, fixes
blueyed Sep 24, 2017
51c4e47
tox: use source from coveragerc
blueyed Sep 24, 2017
431070a
coverage for integration test
blueyed Sep 24, 2017
02ef795
fixup! coverage for integration test
blueyed Sep 24, 2017
a4c348a
fixup! fixup! coverage for integration test
blueyed Sep 24, 2017
1d17320
fixup! fixup! fixup! coverage for integration test
blueyed Sep 24, 2017
c35fc59
fixup! fixup! fixup! fixup! coverage for integration test
blueyed Sep 24, 2017
3883c36
fixup! fixup! fixup! fixup! fixup! coverage for integration test
blueyed Sep 24, 2017
b27f47b
Improve coverage for integration tests
blueyed Sep 24, 2017
3b7327a
fixup! Improve coverage for integration tests
blueyed Sep 24, 2017
bcc94b3
fix test_cli_call for newer/unreleased click
blueyed Sep 24, 2017
2e89a8d
checkqa: flake8-{isort,quotes}
blueyed Sep 24, 2017
53ee226
Minor README revisit
blueyed Sep 24, 2017
39c6a2f
README: enhance Neomake section
blueyed Sep 24, 2017
93a2d36
Factor out get_coveragepy_data
blueyed Sep 24, 2017
49e6e2d
tox: refactor coverage (reporting) envs
blueyed Sep 24, 2017
11b8e20
tests/integration.sh: no -x
blueyed Sep 24, 2017
15f1d4d
tests: cover importing main without running
blueyed Sep 24, 2017
206016f
Makefile: provide coverage-diff helpers, refactor tox
blueyed Sep 24, 2017
d1de9c5
find_func_in_source: change assertion to warning
blueyed Sep 24, 2017
ad7e567
Remove coverage.integration
blueyed Sep 24, 2017
bbfac85
fixup! Remove coverage.integration
blueyed Sep 24, 2017
895f713
Move CoveragePlugin into covimerage.plugin
blueyed Sep 24, 2017
5d5ce48
version 0.0.1.dev1
blueyed Sep 24, 2017
f39e0cd
improve logger
blueyed Sep 24, 2017
a73d998
travis: run pyenv versions
blueyed Sep 24, 2017
42f4d20
isort
blueyed Sep 24, 2017
8b9e0a8
tox: minor cleanup
blueyed Sep 24, 2017
96dd7b1
tox/travis: test all supported versions, move reporting to travis.yml
blueyed Sep 24, 2017
be9691f
job per python version
blueyed Sep 24, 2017
5bd09b7
fixup! tox/travis: test all supported versions, move reporting to tra…
blueyed Sep 24, 2017
967d1fa
fixup! fixup! tox/travis: test all supported versions, move reporting…
blueyed Sep 24, 2017
5d8b145
travis: coverage upload feedback / coveralls
blueyed Sep 24, 2017
ab61f11
fixup! fixup! fixup! tox/travis: test all supported versions, move re…
blueyed Sep 24, 2017
9ab45a9
lazy-install coveralls
blueyed Sep 24, 2017
9c8701b
fixup! Makefile: provide coverage-diff helpers, refactor tox
blueyed Sep 24, 2017
5416cee
better version option
blueyed Sep 25, 2017
0f804b8
better help option
blueyed Sep 25, 2017
b9ae314
add travis badge [skip ci]
blueyed Sep 25, 2017
5a725fd
add conftest
blueyed Sep 25, 2017
03d2091
remove currently unimplemented run command
blueyed Sep 25, 2017
495e625
rename covimerage.plugin to covimerage.coveragepy
blueyed Sep 25, 2017
0ea0e9a
cleanup: remove commented code
blueyed Sep 25, 2017
b5cc1d0
add tests/test_coveragepy.py to cover filereporter.__repr__
blueyed Sep 25, 2017
b4fa316
isort
blueyed Sep 30, 2017
3cb5cf1
MergedProfiles.get_coveragepy_data: add caching
blueyed Sep 30, 2017
ffcf323
fixup! isort
blueyed Sep 30, 2017
5d44533
.travis.yml: just use checkqa
blueyed Sep 30, 2017
eff52b4
pylint-inspired cleanup
blueyed Sep 30, 2017
125a48c
fixup! pylint-inspired cleanup
blueyed Sep 30, 2017
0310ff1
fixup! pylint-inspired cleanup
blueyed Sep 30, 2017
f097cac
.travis.yml: no custom name
blueyed Sep 30, 2017
efd7a40
fix README
blueyed Sep 30, 2017
940ff75
move logging to own module; log to stderr always
blueyed Oct 1, 2017
caeec5d
fixup! move logging to own module; log to stderr always
blueyed Oct 1, 2017
0406c01
Handle 'Cannot open file!' for SCRIPT blocks
blueyed Oct 1, 2017
ca9424b
fixup! Handle 'Cannot open file!' for SCRIPT blocks
blueyed Oct 1, 2017
e637d77
Travis: PYTEST_ADDOPTS
blueyed Oct 1, 2017
0f2064a
fixup! fixup! move logging to own module; log to stderr always
blueyed Oct 1, 2017
9cd327d
Travis: move checkqa to own job
blueyed Oct 1, 2017
32a2f6e
fixup! fixup! move logging to own module; log to stderr always
blueyed Oct 1, 2017
2a6d35f
Harden test_merged_profiles_write_coveragepy_data_handles_fname_and_fobj
blueyed Oct 1, 2017
41ae737
bump version to 0.0.1.dev2
blueyed Oct 1, 2017
891a0cf
fixup! Improve logging/verbosity handling
blueyed Oct 1, 2017
7b9cf14
improve write_coverage
blueyed Oct 1, 2017
b36bee2
fix test_conditional_functions
blueyed Oct 1, 2017
7b1da15
fixup! Travis: PYTEST_ADDOPTS
blueyed Oct 1, 2017
85327ff
tox/setup.py: add dev extras_require
blueyed Oct 1, 2017
2f89790
add CoverageWrapper
blueyed Oct 1, 2017
b666b0b
use CoverageWrapper in test_cli_writecoverage_datafile
blueyed Oct 1, 2017
01089ee
use local imports
blueyed Oct 1, 2017
d631384
fixup! use CoverageWrapper in test_cli_writecoverage_datafile
blueyed Oct 1, 2017
0e471fc
FileReporter/reportxml: handle FileNotFoundError
blueyed Oct 2, 2017
7817ad9
tox: use pytest-cov for subprocess coverage reporting
blueyed Oct 2, 2017
8e1ef31
First shot at using CircleCI
blueyed Oct 2, 2017
4d9b0dc
fixup! First shot at using CircleCI
blueyed Oct 2, 2017
f60f7f2
unwrap setup.py
blueyed Oct 2, 2017
83d2306
fixup! fixup! First shot at using CircleCI
blueyed Oct 2, 2017
5cd2a12
circleci: no cache, use TOXENV
blueyed Oct 2, 2017
9a540b6
fixup! circleci: no cache, use TOXENV
blueyed Oct 2, 2017
e07b6ac
drop integration tests; requires vim to be installed
blueyed Oct 2, 2017
8238cbb
fixup! drop integration tests; requires vim to be installed
blueyed Oct 2, 2017
7cc1fb2
fixup! fixup! drop integration tests; requires vim to be installed
blueyed Oct 2, 2017
34d2203
fixup! fixup! fixup! drop integration tests; requires vim to be insta…
blueyed Oct 2, 2017
8551a43
flag Travis in codecov
blueyed Oct 2, 2017
e3a9fa0
fixup! fixup! fixup! drop integration tests; requires vim to be instal
blueyed Oct 2, 2017
6409841
coveralls?!
blueyed Oct 2, 2017
f89f402
fixup! fixup! circleci: no cache, use TOXENV
blueyed Oct 2, 2017
15c77b0
unfuck PATH on circleci and fix coveralls
blueyed Oct 2, 2017
b2e5f7f
get rid of Travis and coveralls
blueyed Oct 2, 2017
e0a754e
bye
blueyed Oct 2, 2017
7d07f5a
add dunder-main tests
blueyed Oct 2, 2017
38562c9
pragma: no branch for tests
blueyed Oct 2, 2017
67970be
improve get_anon_func_script_line
blueyed Oct 2, 2017
d1c7c30
add run/report/xml commands
blueyed Oct 2, 2017
eb139d4
fixup! get rid of Travis and coveralls
blueyed Oct 3, 2017
70a5589
fix test_cli to use a tmpdir
blueyed Oct 3, 2017
8ca2bc6
remove codecov from tox, bring back coveralls
blueyed Oct 3, 2017
9294f4e
improve run and tests
blueyed Oct 3, 2017
0f2ff94
fixup! fix test_cli to use a tmpdir
blueyed Oct 3, 2017
e2e8990
allow coveralls to fail for now
blueyed Oct 3, 2017
aacba8c
Revert "allow coveralls to fail for now"
blueyed Oct 3, 2017
df464e0
fixup! fixup! fix test_cli to use a tmpdir
blueyed Oct 3, 2017
ce2e286
fixup! improve run and tests
blueyed Oct 3, 2017
7d63b8d
fixup! improve run and tests
blueyed Oct 3, 2017
113f828
testing codecov against base branch
blueyed Oct 3, 2017
8097a23
report can handle profiles directly
blueyed Oct 3, 2017
9366ee1
fixup! report can handle profiles directly
blueyed Oct 3, 2017
b8a79d5
add get_fname_and_fobj_and_str, move StringIO to _compat
blueyed Oct 4, 2017
88d4eb7
fixup! report can handle profiles directly
blueyed Oct 4, 2017
1aa7718
better handling of errors in coveragewrapper
blueyed Oct 4, 2017
9d6e765
fixup! add get_fname_and_fobj_and_str, move StringIO to _compat
blueyed Oct 4, 2017
24a6ba4
circleci: re-add caching
blueyed Oct 4, 2017
eae7608
fixup! better handling of errors in coveragewrapper
blueyed Oct 4, 2017
be110f8
fixup! add get_fname_and_fobj_and_str, move StringIO to _compat
blueyed Oct 4, 2017
66f7124
fixup! better handling of errors in coveragewrapper
blueyed Oct 4, 2017
f00e0fc
fixup! fixup! better handling of errors in coveragewrapper
blueyed Oct 4, 2017
fcda04a
setup.py: extras: pytest-pdb
blueyed Oct 4, 2017
82fc457
fixup! circleci: re-add caching
blueyed Oct 4, 2017
619a976
README: use circleci badge
blueyed Oct 4, 2017
35b851a
update setup.py to bust cache
blueyed Oct 4, 2017
d7a63b0
improve/move ensure_no_coverage_data_changed_in_cwd
blueyed Oct 4, 2017
5439e89
cover run command
blueyed Oct 4, 2017
84c6bda
fixup! improve/move ensure_no_coverage_data_changed_in_cwd
blueyed Oct 4, 2017
7912d90
cleanup logging
blueyed Oct 4, 2017
807a786
cover and cleanup
blueyed Oct 4, 2017
4da288f
add add_profile_files
blueyed Oct 4, 2017
ee1bbc5
fixup! add add_profile_files
blueyed Oct 4, 2017
a77faeb
Merge pull request #4 from blueyed/v2
blueyed Oct 4, 2017
a95bc90
run writes a data file by default
blueyed Oct 4, 2017
2c75ad0
fix ensure_no_coverage_data_changed_in_cwd and test_cli_run_report_fd
blueyed Oct 4, 2017
c5c751d
fixup! fix ensure_no_coverage_data_changed_in_cwd and test_cli_run_re…
blueyed Oct 4, 2017
54c66f1
fixup! fix ensure_no_coverage_data_changed_in_cwd and test_cli_run_re…
blueyed Oct 4, 2017
efca202
Merge pull request #5 from blueyed/fixes
blueyed Oct 4, 2017
fe51334
coding is hard, let's go formatting
blueyed Oct 5, 2017
9ff7539
remove unnecessary noqas
blueyed Oct 5, 2017
fcfb5f5
setuo.py: fix style
blueyed Oct 5, 2017
6c1c2d6
tox/setup.py: use qa deps also in dev
blueyed Oct 5, 2017
173fb03
please isort
blueyed Oct 5, 2017
5939a81
Merge pull request #8 from blueyed/format
blueyed Oct 5, 2017
2976004
Revert "coding is hard, let's go formatting"
blueyed Oct 5, 2017
5a836d6
Makefile: use relative SCRIPT names
blueyed Oct 5, 2017
b03494e
Makefile: add tags target
blueyed Oct 5, 2017
1ee0a11
run: add support for --source and use cwd by default
blueyed Oct 5, 2017
39b65a9
fixup! run: add support for --source and use cwd by default
blueyed Oct 5, 2017
5cdf0e6
fixup! run: add support for --source and use cwd by default
blueyed Oct 5, 2017
7f186bb
Merge pull request #9 from blueyed/source
blueyed Oct 5, 2017
6812ae4
Fix logging: rename logging to logger; handle verbosity correctly (#10)
blueyed Oct 6, 2017
aab031a
FileReporter.source: handle utf8 encoding issues (#11)
blueyed Oct 6, 2017
15988b1
Improve .coveragerc (#13)
blueyed Oct 7, 2017
bbf8032
update README
blueyed Oct 6, 2017
f2cca30
only upload coveralls for py36 - it does not support multiple uploads…
blueyed Oct 6, 2017
80fda9d
minor: remove blanks
blueyed Oct 6, 2017
6da2de5
README: add caveats
blueyed Oct 6, 2017
03c5cfe
add test_cli_xml
blueyed Oct 7, 2017
8998214
write_coverage: use DEFAULT_COVERAGE_DATA_FILE
blueyed Oct 7, 2017
167e085
factor out find_executable_files
blueyed Oct 7, 2017
0aeeabb
add source option to report
blueyed Oct 7, 2017
8398708
add source option to write_coverage
blueyed Oct 7, 2017
4a3de5a
minor
blueyed Oct 7, 2017
f21e9f3
CircleCI: remove py33
blueyed Oct 7, 2017
c811627
run: forward --report-file
blueyed Oct 7, 2017
e11aba5
run: exit with exit code of subprocess
blueyed Oct 8, 2017
6cffba5
Improve CoverageWrapperException
blueyed Oct 8, 2017
4ef9c87
setup.py include testing extras with dev
blueyed Oct 8, 2017
949058b
coveragepy wrapper: short circuit coverage.Coverage._get_file_reporter
blueyed Oct 8, 2017
b8a783f
Add Source.sourced_count
blueyed Oct 8, 2017
b30ee19
fix test_line
blueyed Oct 8, 2017
eb3a5c8
factor out is_executable_line
blueyed Oct 8, 2017
69d588d
move RE_EXCLUDED
blueyed Oct 8, 2017
f7997ef
Fix line count for first line
blueyed Oct 8, 2017
d15c01e
fixup! Add Source.sourced_count
blueyed Oct 8, 2017
bbf2ae2
fix some tests
blueyed Oct 8, 2017
7937513
is_executable_filename: match vimrc at the end
blueyed Oct 8, 2017
226ae14
bump version after publish
blueyed Oct 8, 2017
75d110d
Revert "README: add caveats"
blueyed Oct 8, 2017
1cc3cde
fix "make coverage"
blueyed Oct 8, 2017
f9d1912
run: improve handling of exit code / profile parsing
blueyed Oct 10, 2017
b698f90
improve reporting of running cmd
blueyed Oct 10, 2017
28820d3
add tests for current behavior with pty-spawned subprocesses
blueyed Oct 10, 2017
3acd59f
fixup! improve reporting of running cmd
blueyed Oct 10, 2017
1745835
Fix codecov flags
blueyed Oct 12, 2017
06cd35f
Refactor CoverageData out of CoverageWrapper (#14)
blueyed Oct 14, 2017
e8c84ab
MergedProfiles: support append
blueyed Oct 14, 2017
0be8c48
run: handle profile name/fobj
blueyed Oct 14, 2017
cb2e26a
run: support append
blueyed Oct 14, 2017
5a2429b
run: subprocess.call: do not set close_fds=False
blueyed Oct 14, 2017
94a3b41
improve logging
blueyed Oct 14, 2017
4c1d647
add test_coveragedata_empty
blueyed Oct 15, 2017
b864907
run: --profile: use click.Path
blueyed Oct 15, 2017
c067783
finish append support
blueyed Oct 15, 2017
251e656
fixup! finish append support
blueyed Oct 15, 2017
6bb6344
add test_cli_run_can_skip_writing_data
blueyed Oct 15, 2017
8f37e91
Merge pull request #15 from blueyed/append
blueyed Oct 15, 2017
b2b17fb
test shell_quote
blueyed Oct 15, 2017
79bf62f
add test_run_report_without_data
blueyed Oct 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2

common: &common
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}
- v1-deps-
- run: pip install --user tox
- run: ~/.local/bin/tox
- run:
name: upload coverage results for non-checkqa builds
command: |
if [[ "$TOXENV" != checkqa ]]; then
PATH=$HOME/.local/bin:$PATH
# XXX: use bash script?!
pip install --user codecov
coverage xml
coverage report -m
codecov --required -X search gcov pycov -f coverage.xml --flags $CIRCLE_JOB

if [[ "$CIRCLE_JOB" == py36 ]]; then
pip install --user coveralls
coveralls
fi
set +x
fi
- save_cache:
paths:
- .tox
- ~/.cache/pip
key: v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}
jobs:
py36:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV=py36-coverage
py35:
<<: *common
docker:
- image: circleci/python:3.5
environment:
TOXENV=py35-coverage
py34:
<<: *common
docker:
- image: circleci/python:3.4
environment:
TOXENV=py34-coverage
py27:
<<: *common
docker:
- image: circleci/python:2.7
environment:
TOXENV=py27-coverage
checkqa:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV=checkqa

workflows:
version: 2
test:
jobs:
- py36
- py35
- py34
- py27
- checkqa
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
source = .
include = covimerage/*,tests/*
branch = true

[report]
show_missing = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
100 changes: 100 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
test:
tox -e py36

VIM:=$(shell command -v nvim || echo vim)

test_integration:
tox -e integration

# Fixture generation.
PROFILES_TO_MERGE_COND:=tests/fixtures/merged_conditionals-0.profile \
tests/fixtures/merged_conditionals-1.profile \
tests/fixtures/merged_conditionals-2.profile
fixtures: tests/fixtures/test_plugin.vim.profile
fixtures: tests/fixtures/test_plugin.nvim.profile
fixtures: tests/fixtures/dict_function.profile
fixtures: tests/fixtures/dict_function_with_same_source.profile
fixtures: tests/fixtures/dict_function_with_continued_lines.profile
fixtures: tests/fixtures/dict_function_used_twice.profile
fixtures: tests/fixtures/continued_lines.profile
fixtures: tests/fixtures/conditional_function.profile
fixtures: $(PROFILES_TO_MERGE_COND)

# TODO: cleanup. Should be handled by the generic rule at the bottom.
tests/fixtures/dict_function.profile: tests/test_plugin/dict_function.vim
$(VIM) --noplugin -Nu tests/t.vim --cmd 'let g:prof_fname = "$@"' -c 'source $<' -c q
sed -i 's:^SCRIPT .*/test_plugin:SCRIPT /test_plugin:' $@

tests/fixtures/dict_function_with_same_source.profile: test_plugin/dict_function_with_same_source.vim
$(VIM) --noplugin -Nu tests/t.vim --cmd 'let g:prof_fname = "$@"' -c 'source $<' -c q
sed -i 's:^SCRIPT .*/test_plugin:SCRIPT /test_plugin:' $@

tests/fixtures/test_plugin.vim.profile: test_plugin/autoload/test_plugin.vim
vim --noplugin -Nu tests/t.vim --cmd 'let g:prof_fname = "$@"' -c q

tests/fixtures/test_plugin.nvim.profile: test_plugin/autoload/test_plugin.vim
nvim --noplugin -Nu tests/t.vim --cmd 'let g:prof_fname = "$@"' -c q

PROFILES_TO_MERGE:=tests/fixtures/merge-1.profile tests/fixtures/merge-2.profile
$(PROFILES_TO_MERGE): test_plugin/merged_profiles.vim test_plugin/merged_profiles-init.vim Makefile
$(VIM) -Nu test_plugin/merged_profiles-init.vim -c q
sed -i 's:^SCRIPT .*/test_plugin:SCRIPT /test_plugin:' $(PROFILES_TO_MERGE)

PROFILES_TO_MERGE_COND:=tests/fixtures/merged_conditionals-0.profile \
tests/fixtures/merged_conditionals-1.profile \
tests/fixtures/merged_conditionals-2.profile
$(PROFILES_TO_MERGE_COND): tests/test_plugin/merged_conditionals.vim Makefile
for cond in 0 1 2; do \
$(VIM) --noplugin -Nu tests/t.vim \
--cmd "let g:prof_fname = 'tests/fixtures/merged_conditionals-$$cond.profile'" \
--cmd "let test_conditional = $$cond" \
-c "source $<" -c q; \
done
sed -i 's:^SCRIPT .*/test_plugin:SCRIPT tests/test_plugin:' $(PROFILES_TO_MERGE_COND)

tests/fixtures/%.profile: tests/test_plugin/%.vim Makefile
$(VIM) --noplugin -Nu tests/t.vim --cmd 'let g:prof_fname = "$@"' -c 'source $<' -c q
sed -i 's:^SCRIPT .*/test_plugin:SCRIPT tests/test_plugin:' $@


# Helpers to generate (combined) coverage and show a diff {{{
#
# Use `make coverage-diff` to diff coverage diff to the old state
# (recorded via `make coverage-save`).

MAIN_COVERAGE:=build/coverage

coverage: $(MAIN_COVERAGE)
COVERAGE_FILE=$< coverage report -m

coverage-save: | build
cp -a $(MAIN_COVERAGE) build/coverage.old

coverage-diff: build/covreport.old
coverage-diff: build/covreport.new
coverage-diff:
@diff --color=always -u $^ | /usr/share/git/diff-highlight/diff-highlight | sed 1,3d
@#git --no-pager diff --no-index --color-words build/covreport.old build/covreport.new | sed 1,5d
@# git --no-pager diff --color --no-index build/covreport.old build/covreport.new | sed 1,5d | diff-so-fancy

.PHONY: coverage coverage-save coverage-diff

$(MAIN_COVERAGE): $(shell find covimerage tests -name '*.py') | build
COVERAGE_FILE=$@ tox -e coverage.pytest

build/coverage.old:
$(MAKE) coverage-save

build/covreport.old: build/coverage.old | build
COVERAGE_FILE=$< coverage report -m > $@ || { ret=$$?; cat $@; exit $$ret; }

build/covreport.new: $(MAIN_COVERAGE) | build
COVERAGE_FILE=$< coverage report -m > $@ || { ret=$$?; cat $@; exit $$ret; }
# }}}

tags:
rg --files-with-matches . | ctags --links=no -L-
.PHONY: tags

build:
mkdir -p $@
102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# covimerage

Generates code coverage information for Vim scripts.

It parses the output from Vim's `:profile` command, and generates data
compatible with [Coverage.py](http://coverage.readthedocs.io/).

**NOTE:** this `develop` branch will be squash-merged into master after some
stabilization (1-2 weeks).

[![CircleCI](https://circleci.com/gh/Vimjas/covimerage.svg?style=svg)](https://circleci.com/gh/Vimjas/covimerage)
[![codecov](https://codecov.io/gh/Vimjas/covimerage/branch/develop/graph/badge.svg)](https://codecov.io/gh/Vimjas/covimerage/branch/develop)

## Installation

You can install covimerage using pip:

```sh
pip install covimerage
```

## Simple usage

You can use `covimerage run` to wrap the call to Neovim/Vim with necessary
boilerplate:

```sh
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 to 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](https://codecov.io/)'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:

```vim
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)

```sh
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](http://coverage.readthedocs.io/) 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](https://github.com/neomake/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](https://codecov.io/gh/neomake/neomake/tree/master)
- [PR/change to integrate it in
Neomake](https://github.com/neomake/neomake/pull/1600) (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](https://bitbucket.org/ned/coveragepy/issues/607/)

## TODO

- Line hit counts: known to covimerage, but not supported by Coverage.py
(<https://bitbucket.org/ned/coveragepy/issues/607/#comment-40048034>).
Loading