BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/203984
Change subject: Use tox lint yaml and run flake8
......................................................................
Use tox lint yaml and run flake8
Bug: T95894
Change-Id: Id74f153c940f90450f3db56c87f357074cde15fc
---
A .gitignore
A requirements.txt
A tests/lint_tests.py
A tests/requirements.txt
M tox.ini
5 files changed, 45 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/bots/jouncebot
refs/changes/84/203984/1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c7460f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+/.tox/
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..3ed279a
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+irc
+mwclient
+pytz
+pyyaml
diff --git a/tests/lint_tests.py b/tests/lint_tests.py
new file mode 100644
index 0000000..2095e9a
--- /dev/null
+++ b/tests/lint_tests.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+import os
+import sys
+import yaml
+
+
+def lint_yaml(path):
+ try:
+ yaml.safe_load_all(file(path, 'r'))
+ except yaml.error.YAMLError, exc:
+ print("YAML parse error in %s: %s" % (path, exc), file=sys.stderr)
+ assert False
+
+
+def test_lint_DefaultConfig():
+ lint_yaml(os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ '../DefaultConfig.yaml'))
diff --git a/tests/requirements.txt b/tests/requirements.txt
new file mode 100644
index 0000000..4283f38
--- /dev/null
+++ b/tests/requirements.txt
@@ -0,0 +1,2 @@
+flake8
+nose
diff --git a/tox.ini b/tox.ini
index 8fb1e40..a6a0271 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,12 +1,27 @@
[tox]
minversion = 1.6
skipsdist = True
-envlist = flake8
+envlist = py27, flake8
[flake8]
+count = 1
exclude = bin,lib,include,.venv,.tox,dist,doc,build,*.egg
+ignore = E128
max-line-length = 120
+show-pep8 = 1
+show-source = 1
+statistics = 1
+
+[nosetests]
+detailed-errors=1
+with-doctest=1
[testenv:flake8]
commands = flake8
deps = flake8
+
+[testenv]
+setenv = VIRTUAL_ENV={envdir}
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/tests/requirements.txt
+commands = nosetests
--
To view, visit https://gerrit.wikimedia.org/r/203984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id74f153c940f90450f3db56c87f357074cde15fc
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/bots/jouncebot
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits