Skip to content

Instantly share code, notes, and snippets.

@foxx
Created December 4, 2015 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxx/8bab6b18194203e5b219 to your computer and use it in GitHub Desktop.
Save foxx/8bab6b18194203e5b219 to your computer and use it in GitHub Desktop.
Coderpad pytest support
import os
import sys
import subprocess
def sanitypatch():
"""
Quick hack to install any package we want in coderpad...
Because real coders use pytest, amirite?
"""
print("applying coderpad sanity patch...")
packages = ' '.join(['pytest'])
dst = os.path.expanduser("~/.local/lib/python3.4/site-packages")
cmd = "pip3 install --user {} > /dev/null".format(packages)
os.system(cmd)
sys.path.append(dst)
print("sanity restored")
print("\r\n\r\n")
def main():
args = ['--tb=native', '-s', '-q', __file__]
#args.insert(0, '--pdb')
pytest.main(args)
sanitypatch()
import pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment