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 11version : 2
22
3+ common : &common
4+ working_directory : ~/repo
5+ docker :
6+ - image : blueyed/vim-python-pep8-indent-vims-for-test:2@sha256:a7be5f4d07ed361ce3ca78cedd413d67d583f96ab0a59feb512af89052c50172
7+
38jobs :
49 test :
5- docker :
6- - image : blueyed/vim-python-pep8-indent-vims-for-test:1@sha256:8c77867e1fdf673a6df0ecf6628f8e4d80579a0a097ec196109ca0bc145d86c0
10+ << : *common
711 steps :
812 - checkout
913 - run :
1014 name : Run tests
1115 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
1422
1523 checkqa :
16- docker :
17- - image : circleci/python:3.7
24+ << : *common
1825 steps :
1926 - checkout
2027 - run :
2128 name : Lint
2229 command : |
23- pip install --user vim-vint
24- ~/.local/bin/vint **/*.vim
30+ vint **/*.vim
2531
2632workflows :
2733 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 11*
22! Gemfile
3- ! indent
4- ! spec
Original file line number Diff line number Diff line change 11. * .swp
2+ .coverage_covimerage
Original file line number Diff line number Diff line change 11FROM testbed/vim:latest
22
33RUN 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 \
56 --disable-channel --disable-netbeans --disable-xim \
67 --enable-gui=gtk2 --with-x -build
78RUN ln -s /vim-build/bin/vim-master /usr/bin/gvim
89RUN gvim --version
910
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+
1018WORKDIR /vim-python-pep8-indent
1119
1220ADD Gemfile .
1321RUN apk --no-cache add coreutils ruby-bundler
1422RUN bundle install
1523
16- ADD indent ./indent
17- ADD spec ./spec
18-
1924ENTRYPOINT ["rspec" , "spec" ]
Original file line number Diff line number Diff line change 11test :
22 VIMRUNNER_REUSE_SERVER=1 xvfb-run bundle exec rspec
33
4- test_slow :
5- VIMRUNNER_REUSE_SERVER=0 bundle exec rspec
6-
7- test_visible :
8- VIMRUNNER_REUSE_SERVER=1 bundle exec rspec
9-
104# Run tests in dockerized Vims.
115DOCKER_REPO: =blueyed/vim-python-pep8-indent-vims-for-test
12- DOCKER_TAG: =1
6+ DOCKER_TAG: =2
137DOCKER_IMAGE: =$(DOCKER_REPO ) :$(DOCKER_TAG )
148
159docker_image :
@@ -26,3 +20,6 @@ test_docker:
2620 docker run --rm -ti -e DISPLAY -e VIMRUNNER_REUSE_SERVER=1 \
2721 -v $(CURDIR ) :/vim-python-pep8-indent $(DOCKER_IMAGE ) $(RSPEC_ARGS ) \
2822 $(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 11require "spec_helper"
22
33shared_examples_for "vim" do
4-
54 before ( :each ) {
65 # clear buffer
76 vim . normal 'gg"_dG'
573572 it_behaves_like "multiline strings"
574573end
575574
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-
604575describe "Handles far away opening parens" do
605576 before { vim . feedkeys '\<ESC>ggdGifrom foo import (' }
606577
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 11require 'vimrunner'
22require 'vimrunner/rspec'
3+ require 'vimrunner/server'
34
45# Explicitly enable usage of "should".
56RSpec . configure do |config |
1314 config . reuse_server = ENV [ 'VIMRUNNER_REUSE_SERVER' ] == '1' ? true : false
1415
1516 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
2126
27+ plugin_path = File . expand_path ( '../..' , __FILE__ )
2228 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"
2530
2631 def shiftwidth
2732 @shiftwidth ||= vim . echo ( "exists('*shiftwidth') ? shiftwidth() : &sw" ) . to_i
You can’t perform that action at this time.
0 commit comments