Skip to content

Commit

Permalink
initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Feb 12, 2010
0 parents commit 66101a0
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.*\.egg-info
Empty file added codecheckers/__init__.py
Empty file.
Empty file added codecheckers/flakes.py
Empty file.
Empty file added codecheckers/pep.py
Empty file.
25 changes: 25 additions & 0 deletions codecheckers/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import py

import pkg_resources


class PyCodeCheckItem(py.test.collect.Item):
def __init__(self, ep, parent):
py.test.collect.Item.__init__(self, ep.name, parent)
self._ep = ep

def runtest(self):
mod = self._ep.load()



class PyCheckerCollector(py.test.collect.File):
def collect(self):
entrypoints = pkg_resources.iter_entry_points('codechecker')
return [PyCodeCheckItem(ep, self) for ep in entrypoints]


def pytest_collect_file(path, parent):
if path.ext == '.py':
return PyCheckerCollector(path, parent)

25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from setuptools import setup

setup(
name='pytest-codecheckers',
description='pytest addon to add code-checking as source for testcases',
version='0.0',
author='Ronny Pfannschmidt',
author_email='[email protected]',
packages=[
'codecheckers',
],
entry_points = {
'pytest11': [
'codechecker = codecheckers.plugin',
],
'codechecker': [
'pep8 = codecheckers.pep',
'pyflakes = codecheckers.flakes',
],
},
install_requires=[
'pyflakes>=0.4',
'pep8',
],
)
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

pytest_plugins = 'pytester',
16 changes: 16 additions & 0 deletions tests/test_pyflakes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import py


def test_pyflakes_finds_name_error(testdir):
testdir.makepyfile('''
def tesdt_a():
pass
def b():
abc
''')
out = testdir.runpytest()
out.stdout.fnmatch_lines([
'*1 Failed*',
])
print(out)
assert 0

0 comments on commit 66101a0

Please sign in to comment.