Add failing test for versioned repositories.

This commit is contained in:
Anthony Sottile
2014-06-01 21:09:02 -07:00
parent 3baae2fd1e
commit fdd6989ece
6 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
- id: python3-hook
name: Python 3 Hook
entry: python3-hook
language: python
language_version: python3.3

View File

@@ -0,0 +1,9 @@
from __future__ import print_function
import sys
def func():
print('{0}.{1}'.format(*sys.version_info[:2]))
print(repr(sys.argv[1:]))
print('Hello World')
return 0

View File

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

View File

@@ -72,6 +72,11 @@ def python_hooks_repo(dummy_git_repo):
yield _make_repo(dummy_git_repo, 'python_hooks_repo')
@pytest.yield_fixture
def python3_hooks_repo(dummy_git_repo):
yield _make_repo(dummy_git_repo, 'python3_hooks_repo')
@pytest.yield_fixture
def node_hooks_repo(dummy_git_repo):
yield _make_repo(dummy_git_repo, 'node_hooks_repo')
@@ -133,6 +138,11 @@ def config_for_python_hooks_repo(python_hooks_repo):
yield _make_config(python_hooks_repo, 'foo', '\\.py$')
@pytest.yield_fixture
def config_for_python3_hooks_repo(python3_hooks_repo):
yield _make_config(python3_hooks_repo, 'python3-hook', '\\.py$')
@pytest.yield_fixture
def config_for_prints_cwd_repo(prints_cwd_repo):
yield _make_config(prints_cwd_repo, 'prints_cwd', '^$')

View File

@@ -24,6 +24,15 @@ def test_run_a_python_hook(config_for_python_hooks_repo, store):
assert ret[1] == "['/dev/null']\nHello World\n"
@pytest.mark.xfail
@pytest.mark.integration
def test_run_versioned_hook(config_for_python3_hooks_repo, store):
repo = Repository.create(config_for_python3_hooks_repo, store)
ret = repo.run_hook('python3-hook', ['/dev/null'])
assert ret[0] == 0
assert ret[1] == "3.3\n['/dev/null']\nHello World\n"
@pytest.mark.integration
def test_lots_of_files(config_for_python_hooks_repo, store):
repo = Repository.create(config_for_python_hooks_repo, store)