summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-09-25 18:48:03 +0300
committerLars Wirzenius <liw@liw.fi>2016-09-25 18:48:03 +0300
commit2a5ceeafa683780e679b07c5e9199c196ee65703 (patch)
treece158c08e82bb3930b42219b9f43b5d37e80ba1a
parentce3456fc26e02cc369b287a6ef7245c03be0a7f1 (diff)
downloadserver-yarns-2a5ceeafa683780e679b07c5e9199c196ee65703.tar.gz
Start a YarnHelper class
-rwxr-xr-xcheck5
-rw-r--r--yarnhelper.py30
-rw-r--r--yarnhelper_tests.py30
3 files changed, 65 insertions, 0 deletions
diff --git a/check b/check
new file mode 100755
index 0000000..21b8029
--- /dev/null
+++ b/check
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -eu
+
+python -m CoverageTestRunner
diff --git a/yarnhelper.py b/yarnhelper.py
new file mode 100644
index 0000000..f313ab4
--- /dev/null
+++ b/yarnhelper.py
@@ -0,0 +1,30 @@
+# Copyright 2016 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# =*= License: GPL-3+ =*=
+
+
+class YarnHelper(object):
+
+ def set_environment(self, env):
+ pass
+
+ def get_next_match(self):
+ raise Error('no next match')
+
+
+class Error(Exception):
+
+ pass
diff --git a/yarnhelper_tests.py b/yarnhelper_tests.py
new file mode 100644
index 0000000..2e64f93
--- /dev/null
+++ b/yarnhelper_tests.py
@@ -0,0 +1,30 @@
+# Copyright 2016 Lars Wirzenius
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# =*= License: GPL-3+ =*=
+
+
+import unittest
+
+import yarnhelper
+
+
+class GetNextMatchTests(unittest.TestCase):
+
+ def test_raises_error_if_no_next_match(self):
+ h = yarnhelper.YarnHelper()
+ h.set_environment({})
+ with self.assertRaises(yarnhelper.Error):
+ h.get_next_match()