[Pkg-debile-commits] [debile-slave] 14/100: meh, tests.
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:53:00 UTC 2013
This is an automated email from the git hooks/post-receive script.
sylvestre pushed a commit to branch master
in repository debile-slave.
commit f7d67118944f44df828ed548849772a24eb47628
Author: Paul Tagliamonte <tag at pault.ag>
Date: Fri May 24 21:30:36 2013 -0400
meh, tests.
---
ethel/wrappers/pep8.py | 22 ++++++++++++++++++++++
tests/wrappers/test_pep8.py | 21 +++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/ethel/wrappers/pep8.py b/ethel/wrappers/pep8.py
new file mode 100644
index 0000000..fd2a954
--- /dev/null
+++ b/ethel/wrappers/pep8.py
@@ -0,0 +1,22 @@
+from firehose.model import Issue, Message, File, Location, Point
+import re
+
+
+LINE_RE = re.compile(
+ r"(?P<path>.*):(?P<line>\d+):(?P<col>\d+): (?P<err>[^ ]+) (?P<msg>.*)"
+)
+
+def parse_pep8(lines):
+ for line in lines:
+ info = LINE_RE.match(line).groupdict()
+ severity = "error" if info['err'].startswith("E") else "warning"
+ yield Issue(cwe=None,
+ testid=info['err'],
+ location=Location(file=File(info['path'], None),
+ function=None,
+ point=Point(*(int(x) for x in (
+ info['line'], info['col'])))),
+ severity=severity,
+ message=Message(text=line),
+ notes=None,
+ trace=None)
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/wrappers/__init__.py b/tests/wrappers/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/wrappers/test_pep8.py b/tests/wrappers/test_pep8.py
new file mode 100644
index 0000000..8a819ec
--- /dev/null
+++ b/tests/wrappers/test_pep8.py
@@ -0,0 +1,21 @@
+from ethel.wrappers.pep8 import parse_pep8
+
+
+STRINGS = [
+ ("./setup.py:21:17: E251 no spaces around keyword / parameter equals",
+ "E251"),
+ ("./setup.py:21:19: E251 no spaces around keyword / parameter equals",
+ "E251"),
+ ("./ethel/daemon.py:18:1: E303 too many blank lines (3)",
+ "E303"),
+ ("./ethel/wrappers/pep8.py:7:1: W391 blank line at end of file",
+ "W391"),
+ ("./ethel/commands/piuparts.py:43:21: E126 continuation line over-indented"
+ " for hanging indent",
+ "E126"),
+]
+
+def test_strings():
+ for string, code in STRINGS:
+ issue = next(parse_pep8([string]))
+ assert issue.testid == code
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git
More information about the Pkg-debile-commits
mailing list