Overview

Let's use TextMate to run the currently highlighted test in pytest.

Analysis

TextMate is a cult favorite, and believe it or not it's actively supported and developed1.

TextMate has a rich toolkit for developers, including the ability to create Commands.

What are Commands?

Commands are scripts executed by the interpreter of your choice2. They can be created in Python, Bash, or any language you choose. For the example below, we'll work in bash.

The Command

#!/bin/bash

/usr/local/bin/pytest ${TM_FILEPATH} -k ${TM_CURRENT_WORD}

Try it out

This command is available to download via Dropbox, and also on Github.

To install:

  1. Double-click the .tmCommand file.
  2. TextMate will prompt you to select a bundle.
    • If you have a custom bundle, choose that one.
    • If you don't, choose Python.
  3. Click 'OK'
  4. You can now use the command by pressing F19.
    • You can customize this by editing the command.

© 2017. All Rights Reserved.