Add Runner interface.

This commit is contained in:
Anthony Sottile 2014-03-23 16:22:24 -07:00
parent ae1d1681b2
commit 88686d298f
25 changed files with 282 additions and 148 deletions

0
testing/__init__.py Normal file
View file

View file

@ -0,0 +1,2 @@
- foo
- bar

View file

@ -0,0 +1,22 @@
- repo: git@github.com:pre-commit/pre-commit-hooks
sha: 76739902911688e8d7b13241409f9facc0e534e4
hooks:
- id: pyflakes
files: '\.py$'
- id: debug-statements
files: '\.py$'
- id: trailing-whitespace
files: '\.(py|sh|yaml)$'
- id: name-tests-test
files: 'tests/.+\.py$'
- id: end-of-file-fixer
files: '\.(py|sh|yaml)$'
- repo: git@github.com:pre-commit/pre-commit
sha: 47b7ca44ed1fcaa83464ed00cef72049ae22c33d
hooks:
- id: validate_manifest
files: '^manifest.yaml$'
- id: validate_config
files: \.pre-commit-config.yaml

View file

@ -0,0 +1,3 @@
#!/usr/bin/env node
console.log('Hello World');

View file

@ -0,0 +1,4 @@
- id: foo
name: Foo
entry: foo
language: node

View file

@ -0,0 +1,5 @@
{
"name": "foo",
"version": "0.0.1",
"bin": {"foo": "./bin/main.js"}
}

View file

@ -0,0 +1 @@
foo: "

View file

@ -0,0 +1,6 @@
import sys
def func():
print repr(sys.argv[1:])
print 'Hello World'
return 0

View file

@ -0,0 +1,4 @@
- id: foo
name: Foo
entry: foo
language: python

View file

@ -0,0 +1,11 @@
from setuptools import find_packages
from setuptools import setup
setup(
name='Foo',
version='0.0.0',
packages=find_packages('.'),
entry_points={
'console_scripts': ['foo = foo.main:func'],
},
)

View file

@ -0,0 +1,7 @@
- repo: git@github.com:pre-commit/pre-commit-hooks
hooks:
- id: pyflakes
- id: jslint
- id: trim_trailing_whitespace
files: '*.py'

View file

@ -0,0 +1 @@
foo: bar

29
testing/util.py Normal file
View file

@ -0,0 +1,29 @@
import os
import os.path
import shutil
TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
def get_resource_path(path):
return os.path.join(TESTING_DIR, 'resources', path)
def copy_tree_to_path(src_dir, dest_dir):
"""Copies all of the things inside src_dir to an already existing dest_dir.
This looks eerily similar to shutil.copytree, but copytree has no option
for not creating dest_dir.
"""
names = os.listdir(src_dir)
for name in names:
srcname = os.path.join(src_dir, name)
destname = os.path.join(dest_dir, name)
if os.path.isdir(srcname):
shutil.copytree(srcname, destname)
else:
shutil.copy(srcname, destname)