Ⅰ. 插件描述
Plugin wrapping nosetests command to be executed inside VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/vim-nose'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/vim-nose'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/vim-nose'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/vim-nose
Ⅳ. 文档说明
vim-nose
Plugin wrapping nosetests command line tool to execute python tests inside Vim. All in the name of productivity!
Features
This plugin improve on Vim compiler option by adding some features specific to nose:
Configurable python virtual environment.
Isolate tests to be run. Run a specific test, a test case, a test module or run all tests (requires git).
Memorize last test ran. The last test will run when commands are executed in non-test modules.
Populate Vim quickfix window with failing tests and errors for easy navigation.
Requirements
For this plugin to have some value, you need this requirements to be installed in your environment:
python
nose
These requirement are optional but improve the plugin usage:
git
vim-dispatch by Tim Pope to run tests asynchronously
VirtualEnv Configuration
Plugin support two configuration options to help discovery of virtual environment.
A configuration file (usually located at the root of your project).
A git configuration (vim-nose.venv) in your git repository
If none of those configuration are set, the plugin will use either the system environment or any virtualenv already set in Vim process (terminal only).
See the plugin documentation for more details (:h nose-virtualenv).
Usage
:RunTest
Run the current test surrounding the cursor position. Otherwise, run all tests in the scope the cursor is located in (i.e. test case or module).
:RunCase
Run all tests found in the test case surrounding the cursor position. If cursor is outside a test case scope, all tests for the module (buffer) are run.
:RunModule
Run all tests found in the current module (buffer).
:RunAllTests
Run all tests found in the git repository of the edited buffer.
Interactive commands
All :Run... command can also be launched in interactive mode. This will run tests synchronously in an external console (if possible). This is useful for debugging your program or tests. For instance, using ipdb inside gVim or MacVim basic shell does not support coloring! This is an attempt to fix this problem.
Example:
:RunTest!
License
Copyright © Pascal Lalancette. Distributed under the same terms as Vim itself. See :help license.