Sublime: Customize your own build system

New Build System
{
    "cmd": ["python", "-m", "unittest", "-v", "$file"],
    "selector": "source.python",
    "file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)"
}

Making use of the build system customization in Sublime enables a python unit test build. These are the key names with respective implications:

  • cmd
    A list of strings specifying the executable to run, plus any arguments to pass to it.

  • selector
    The base scope name of the syntax that this build system should be enabled for.

  • file_regex
    A string containing a regular expression to run on the build output to match file information. The matched file information is used to enable result navigation. The regex should capture 2, 3 or 4 groups. The capture groups should be:

    • filename
    • line number
    • column number
    • message

Reference

Build Systems
Unit testing framework

推荐阅读更多精彩内容