diff --git a/Changelog.mkd b/Changelog.mkd index ed2e264..7bdd402 100644 --- a/Changelog.mkd +++ b/Changelog.mkd @@ -1,3 +1,8 @@ +### v0.7.0 2020-02-07 + +* Updated the pytest command and fixed the color bug. +* Added additional arguments support. + ### v0.6.0 2013-08-03 * Include detailed multi-line error message as plain message diff --git a/README.mkd b/README.mkd index 16f182f..34270cd 100644 --- a/README.mkd +++ b/README.mkd @@ -6,21 +6,53 @@ * Download stable version at vim.org: [pytest-compiler] * Or, use a [plugin manager] and install from - + . + For example, with [vim-plug]: + +```vim +Plug '5long/pytest-vim-compiler' +``` ## Usage Just execute `:compiler pytest` and you're done. -Well, no. You're gonna need one of the following: +Well, no. You're going to need one of the following: -* plain `:make`. see [Vim docs for more][doc make] +* plain `:make`. See [Vim docs for more][doc make] * [MakeGreen](https://github.com/reinh/vim-makegreen) * [dispatch.vim](https://github.com/tpope/vim-dispatch) +## Configuration + +| Name | type | Default | +|--------------------------|--------|---------| +| `g:pytest_compiler_args` | string | `""` | + +If set in your vim configuration, it will always be passed to CompilerSet as +additional arguments, saving you the trouble to manually add flags you use every +time (for example: `--ff --junit-xml=report.xml`). + +You can define this at runtime as well, but you will have to call `:compiler pytest` +again, after. + +Even when defined, you can still pass additional arguments with each make run. + +### Fixing pytest layout in Dispatch windows + +You'll notice that the pytest layout is broken in the quickfix window when running `:Dispatch`. + +To fix that, install the pytest plugin [pytest-vimqf](https://github.com/CarloDePieri/pytest-vimqf) +and add the relative flag in your vim configuration: + +```vim +let g:pytest_compiler_args = "--vim-quickfix" +``` + ## License MIT Licensed. See file LICENSE. [pytest-compiler]: http://www.vim.org/scripts/script.php?script_id=4508 [plugin manager]: http://vim-scripts.org/vim/tools.html +[vim-plug]: https://github.com/junegunn/vim-plug [doc make]: http://vimdoc.sourceforge.net/htmldoc/usr_30.html#30.1 diff --git a/compiler/pytest.vim b/compiler/pytest.vim index 28a44ef..a5a72c7 100644 --- a/compiler/pytest.vim +++ b/compiler/pytest.vim @@ -15,7 +15,12 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=py.test\ --tb=short\ -q +let s:compiler_set = "CompilerSet makeprg=pytest\\ --color=no\\ --tb=short\\ -q" +if exists('g:pytest_compiler_args') + let s:args = substitute(g:pytest_compiler_args, " ", "\\\\ ", "g") + let s:compiler_set .= "\\ " . s:args +endif +execute s:compiler_set CompilerSet errorformat= \%-G=%#\ ERRORS\ =%#,