-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 66101a0
Showing
8 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.*\.egg-info |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
pytest_plugins = 'pytester', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |