I’ve set up Travis CI for dotfiles finally. The idea is to clone the repository, configure the deployment and to conduct various tests with it. The most interesting and challenging part is of course testing. To check various vim functionality in different scenarios automatically, PTY is required.

It turned out to be simple with Python:

# Run shell in a PTY
master, slave = pty.openpty()
child = subprocess.Popen(['bash'], stdin=slave)

# Feed the child with timed input
for delay, key in InputReader():
    time.sleep(delay)
    os.write(master, bytes(chr(key), 'utf-8'))

And there is the showcase: