jenkins-bot has submitted this change and it was merged.

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, 44 insertions(+), 1 deletion(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



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..9468d4e
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,6 @@
+irc
+lxml
+mwclient
+python-dateutil
+pytz
+pyyaml
diff --git a/tests/lint_tests.py b/tests/lint_tests.py
new file mode 100644
index 0000000..5329424
--- /dev/null
+++ b/tests/lint_tests.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import yaml
+
+
+def lint_yaml(path):
+    try:
+        obj = yaml.safe_load(file(path, 'r'))
+        assert obj, "Parse failed for %s: empty result" % path
+    except yaml.error.YAMLError, exc:
+        assert False, "YAML parse error in %s: %s" % (path, exc)
+
+
+def test_lint_DefaultConfig():
+    lint_yaml(os.path.realpath(
+        os.path.join(os.path.dirname(__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..83dd5a4 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 {posargs}

-- 
To view, visit https://gerrit.wikimedia.org/r/203984
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id74f153c940f90450f3db56c87f357074cde15fc
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/bots/jouncebot
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to