File tree Expand file tree Collapse file tree 11 files changed +127
-57
lines changed Expand file tree Collapse file tree 11 files changed +127
-57
lines changed Original file line number Diff line number Diff line change 1
1
version : 2
2
2
3
+ common : &common
4
+ working_directory : ~/repo
5
+ docker :
6
+ - image : blueyed/vim-python-pep8-indent-vims-for-test:2@sha256:a7be5f4d07ed361ce3ca78cedd413d67d583f96ab0a59feb512af89052c50172
7
+
3
8
jobs :
4
9
test :
5
- docker :
6
- - image : blueyed/vim-python-pep8-indent-vims-for-test:1@sha256:8c77867e1fdf673a6df0ecf6628f8e4d80579a0a097ec196109ca0bc145d86c0
10
+ << : *common
7
11
steps :
8
12
- checkout
9
13
- run :
10
14
name : Run tests
11
15
command : |
12
- Xvfb :99 &
13
- DISPLAY=:99 VIMRUNNER_REUSE_SERVER=1 rspec spec
16
+ spec/make-coverage
17
+ - run :
18
+ name : Report coverage
19
+ command : |
20
+ covimerage xml
21
+ codecov -X search gcov pycov -f coverage.xml
14
22
15
23
checkqa :
16
- docker :
17
- - image : circleci/python:3.7
24
+ << : *common
18
25
steps :
19
26
- checkout
20
27
- run :
21
28
name : Lint
22
29
command : |
23
- pip install --user vim-vint
24
- ~/.local/bin/vint **/*.vim
30
+ vint **/*.vim
25
31
26
32
workflows :
27
33
version : 2
Original file line number Diff line number Diff line change
1
+ [run]
2
+ plugins = covimerage
3
+ data_file = .coverage_covimerage
4
+ source = indent/python.vim
5
+
6
+ [report]
7
+ include = indent/python.vim
Original file line number Diff line number Diff line change 1
1
*
2
2
! Gemfile
3
- ! indent
4
- ! spec
Original file line number Diff line number Diff line change 1
1
. * .swp
2
+ .coverage_covimerage
Original file line number Diff line number Diff line change 1
1
FROM testbed/vim:latest
2
2
3
3
RUN apk --no-cache add gtk+2.0-dev libx11-dev libxt-dev mcookie xauth xvfb
4
- RUN install_vim -tag master --with-features=normal \
4
+ # NOTE: +profile needs huge features.
5
+ RUN install_vim -tag master --with-features=huge \
5
6
--disable-channel --disable-netbeans --disable-xim \
6
7
--enable-gui=gtk2 --with-x -build
7
8
RUN ln -s /vim-build/bin/vim-master /usr/bin/gvim
8
9
RUN gvim --version
9
10
11
+ # Install covimerage and vint.
12
+ # NOTE: we have py2 already via gtk+2.0-dev.
13
+ # NOTE: enum34+pathlib+typing gets installed as workaround for broken vim-vint wheel.
14
+ RUN apk --no-cache add py2-pip \
15
+ && pip install --no-cache-dir codecov covimerage==0.0.9 vim-vint enum34 pathlib typing \
16
+ && rm -rf /usr/include /usr/lib/python*/turtle* /usr/lib/python*/tkinter
17
+
10
18
WORKDIR /vim-python-pep8-indent
11
19
12
20
ADD Gemfile .
13
21
RUN apk --no-cache add coreutils ruby-bundler
14
22
RUN bundle install
15
23
16
- ADD indent ./indent
17
- ADD spec ./spec
18
-
19
24
ENTRYPOINT ["rspec" , "spec" ]
Original file line number Diff line number Diff line change 1
1
test :
2
2
VIMRUNNER_REUSE_SERVER=1 xvfb-run bundle exec rspec
3
3
4
- test_slow :
5
- VIMRUNNER_REUSE_SERVER=0 bundle exec rspec
6
-
7
- test_visible :
8
- VIMRUNNER_REUSE_SERVER=1 bundle exec rspec
9
-
10
4
# Run tests in dockerized Vims.
11
5
DOCKER_REPO: =blueyed/vim-python-pep8-indent-vims-for-test
12
- DOCKER_TAG: =1
6
+ DOCKER_TAG: =2
13
7
DOCKER_IMAGE: =$(DOCKER_REPO ) :$(DOCKER_TAG )
14
8
15
9
docker_image :
@@ -26,3 +20,6 @@ test_docker:
26
20
docker run --rm -ti -e DISPLAY -e VIMRUNNER_REUSE_SERVER=1 \
27
21
-v $(CURDIR ) :/vim-python-pep8-indent $(DOCKER_IMAGE ) $(RSPEC_ARGS ) \
28
22
$(if $(VIMRUNNER_TEST_DISPLAY ) ,,; ret=$$? ; kill $$XVFB_PID; exit $$ret)
23
+
24
+ test_coverage :
25
+ spec/make-coverage
Original file line number Diff line number Diff line change
1
+ require "spec_helper"
2
+
3
+ describe "vim for cython" do
4
+ before ( :all ) {
5
+ vim . command "new"
6
+ vim . command "set ft=cython"
7
+ # vim.command("set indentexpr?").should include "GetPythonPEPIndent("
8
+ }
9
+ before ( :each ) {
10
+ # Insert two blank lines.
11
+ # The first line is a corner case in this plugin that would shadow the
12
+ # correct behaviour of other tests. Thus we explicitly jump to the first
13
+ # line when we require so.
14
+ vim . feedkeys 'i\<CR>\<CR>\<ESC>'
15
+ }
16
+ after ( :all ) {
17
+ vim . command "bwipe!"
18
+ }
19
+
20
+ describe "when using a cdef function definition" do
21
+ it "indents shiftwidth spaces" do
22
+ vim . feedkeys 'icdef long_function_name(\<CR>arg'
23
+ indent . should == shiftwidth * 2
24
+ end
25
+ end
26
+
27
+ describe "when using a cpdef function definition" do
28
+ it "indents shiftwidth spaces" do
29
+ vim . feedkeys 'icpdef long_function_name(\<CR>arg'
30
+ indent . should == shiftwidth * 2
31
+ end
32
+ end
33
+ end
Original file line number Diff line number Diff line change 1
1
require "spec_helper"
2
2
3
3
shared_examples_for "vim" do
4
-
5
4
before ( :each ) {
6
5
# clear buffer
7
6
vim . normal 'gg"_dG'
573
572
it_behaves_like "multiline strings"
574
573
end
575
574
576
- describe "vim for cython" do
577
- before {
578
- vim . command "enew"
579
- vim . command "set ft=cython"
580
- vim . command "runtime indent/python.vim"
581
-
582
- # Insert two blank lines.
583
- # The first line is a corner case in this plugin that would shadow the
584
- # correct behaviour of other tests. Thus we explicitly jump to the first
585
- # line when we require so.
586
- vim . feedkeys 'i\<CR>\<CR>\<ESC>'
587
- }
588
-
589
- describe "when using a cdef function definition" do
590
- it "indents shiftwidth spaces" do
591
- vim . feedkeys 'icdef long_function_name(\<CR>arg'
592
- indent . should == shiftwidth * 2
593
- end
594
- end
595
-
596
- describe "when using a cpdef function definition" do
597
- it "indents shiftwidth spaces" do
598
- vim . feedkeys 'icpdef long_function_name(\<CR>arg'
599
- indent . should == shiftwidth * 2
600
- end
601
- end
602
- end
603
-
604
575
describe "Handles far away opening parens" do
605
576
before { vim . feedkeys '\<ESC>ggdGifrom foo import (' }
606
577
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ set -ex
4
+
5
+ rm -f .coverage_covimerage
6
+ export PYTHON_PEP8_INDENT_TEST_PROFILE_BASE=/tmp/vim-python-pep8-profile
7
+
8
+ Xvfb :99 2> /dev/null >&2 &
9
+ export DISPLAY=:99
10
+
11
+ export VIMRUNNER_REUSE_SERVER=1
12
+
13
+ ret=0
14
+ for file in ./spec/indent/* _spec.rb; do
15
+ # shellcheck disable=SC2086
16
+ bundle exec rspec " $file " $RSPEC_OPTIONS || ret=1
17
+
18
+ for p in " ${PYTHON_PEP8_INDENT_TEST_PROFILE_BASE} " .* ; do
19
+ cat " $p "
20
+ covimerage write_coverage --append " $p "
21
+ rm " $p "
22
+ covimerage report -m
23
+ done
24
+ done
25
+ exit $ret
Original file line number Diff line number Diff line change 1
1
require 'vimrunner'
2
2
require 'vimrunner/rspec'
3
+ require 'vimrunner/server'
3
4
4
5
# Explicitly enable usage of "should".
5
6
RSpec . configure do |config |
13
14
config . reuse_server = ENV [ 'VIMRUNNER_REUSE_SERVER' ] == '1' ? true : false
14
15
15
16
config . start_vim do
16
- vim = config . reuse_server ? Vimrunner . start_gvim : Vimrunner . start
17
- plugin_path = File . expand_path ( '../..' , __FILE__ )
18
-
19
- # add_plugin appends the path to the rtp... :(
20
- # vim.add_plugin(plugin_path, 'indent/python.vim')
17
+ exe = config . reuse_server ? Vimrunner ::Platform . gvim : Vimrunner ::Platform . vim
18
+ vimrc = File . expand_path ( "../vimrc" , __FILE__ )
19
+ vim = Vimrunner ::Server . new ( :executable => exe ,
20
+ :vimrc => vimrc ) . start
21
+ # More friendly killing.
22
+ # Otherwise profiling information might not be written.
23
+ def vim . kill
24
+ normal ( ':qall!' )
25
+ end
21
26
27
+ plugin_path = File . expand_path ( '../..' , __FILE__ )
22
28
vim . command "set rtp^=#{ plugin_path } "
23
- vim . command "runtime syntax/python.vim"
24
- vim . command "runtime indent/python.vim"
29
+ vim . command "set filetype=python"
25
30
26
31
def shiftwidth
27
32
@shiftwidth ||= vim . echo ( "exists('*shiftwidth') ? shiftwidth() : &sw" ) . to_i
You can’t perform that action at this time.
0 commit comments