-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Coverage reporting via covimerage (#107)
This splits out the tests for cython, since the runtime file gets reloaded for them, and that resets profiling information.
- Loading branch information
Showing
11 changed files
with
127 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[run] | ||
plugins = covimerage | ||
data_file = .coverage_covimerage | ||
source = indent/python.vim | ||
|
||
[report] | ||
include = indent/python.vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
* | ||
!Gemfile | ||
!indent | ||
!spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.*.swp | ||
.coverage_covimerage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
FROM testbed/vim:latest | ||
|
||
RUN apk --no-cache add gtk+2.0-dev libx11-dev libxt-dev mcookie xauth xvfb | ||
RUN install_vim -tag master --with-features=normal \ | ||
# NOTE: +profile needs huge features. | ||
RUN install_vim -tag master --with-features=huge \ | ||
--disable-channel --disable-netbeans --disable-xim \ | ||
--enable-gui=gtk2 --with-x -build | ||
RUN ln -s /vim-build/bin/vim-master /usr/bin/gvim | ||
RUN gvim --version | ||
|
||
# Install covimerage and vint. | ||
# NOTE: we have py2 already via gtk+2.0-dev. | ||
# NOTE: enum34+pathlib+typing gets installed as workaround for broken vim-vint wheel. | ||
RUN apk --no-cache add py2-pip \ | ||
&& pip install --no-cache-dir codecov covimerage==0.0.9 vim-vint enum34 pathlib typing \ | ||
&& rm -rf /usr/include /usr/lib/python*/turtle* /usr/lib/python*/tkinter | ||
|
||
WORKDIR /vim-python-pep8-indent | ||
|
||
ADD Gemfile . | ||
RUN apk --no-cache add coreutils ruby-bundler | ||
RUN bundle install | ||
|
||
ADD indent ./indent | ||
ADD spec ./spec | ||
|
||
ENTRYPOINT ["rspec", "spec"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require "spec_helper" | ||
|
||
describe "vim for cython" do | ||
before(:all) { | ||
vim.command "new" | ||
vim.command "set ft=cython" | ||
# vim.command("set indentexpr?").should include "GetPythonPEPIndent(" | ||
} | ||
before(:each) { | ||
# Insert two blank lines. | ||
# The first line is a corner case in this plugin that would shadow the | ||
# correct behaviour of other tests. Thus we explicitly jump to the first | ||
# line when we require so. | ||
vim.feedkeys 'i\<CR>\<CR>\<ESC>' | ||
} | ||
after(:all) { | ||
vim.command "bwipe!" | ||
} | ||
|
||
describe "when using a cdef function definition" do | ||
it "indents shiftwidth spaces" do | ||
vim.feedkeys 'icdef long_function_name(\<CR>arg' | ||
indent.should == shiftwidth * 2 | ||
end | ||
end | ||
|
||
describe "when using a cpdef function definition" do | ||
it "indents shiftwidth spaces" do | ||
vim.feedkeys 'icpdef long_function_name(\<CR>arg' | ||
indent.should == shiftwidth * 2 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
rm -f .coverage_covimerage | ||
export PYTHON_PEP8_INDENT_TEST_PROFILE_BASE=/tmp/vim-python-pep8-profile | ||
|
||
Xvfb :99 2>/dev/null >&2 & | ||
export DISPLAY=:99 | ||
|
||
export VIMRUNNER_REUSE_SERVER=1 | ||
|
||
ret=0 | ||
for file in ./spec/indent/*_spec.rb; do | ||
# shellcheck disable=SC2086 | ||
bundle exec rspec "$file" $RSPEC_OPTIONS || ret=1 | ||
|
||
for p in "${PYTHON_PEP8_INDENT_TEST_PROFILE_BASE}".*; do | ||
cat "$p" | ||
covimerage write_coverage --append "$p" | ||
rm "$p" | ||
covimerage report -m | ||
done | ||
done | ||
exit $ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
" vint: -ProhibitSetNoCompatible | ||
set nocompatible | ||
|
||
filetype plugin on | ||
filetype indent on | ||
syntax on | ||
|
||
set noswapfile nobackup | ||
|
||
" remove default ~/.vim directories to avoid loading plugins | ||
set runtimepath-=~/.vim | ||
set runtimepath-=~/.vim/after | ||
|
||
let sfile = expand('<sfile>') | ||
let plugin_path = fnamemodify(sfile, ':p:h:h') | ||
exe 'set runtimepath^='.plugin_path | ||
|
||
if !empty($PYTHON_PEP8_INDENT_TEST_PROFILE_BASE) | ||
execute printf('profile start %s.%s', | ||
\ $PYTHON_PEP8_INDENT_TEST_PROFILE_BASE, getpid()) | ||
execute 'profile! file '. plugin_path . '/indent/python.vim' | ||
endif |