From 37e135d40931617e9e135e15cb0e6dad0667b0cb Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 20 Jul 2013 21:19:14 +0200 Subject: tried to fix hoster tester, removed unneeded files --- tests/helper/parser.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/helper/parser.py (limited to 'tests/helper/parser.py') diff --git a/tests/helper/parser.py b/tests/helper/parser.py new file mode 100644 index 000000000..5031ca7c3 --- /dev/null +++ b/tests/helper/parser.py @@ -0,0 +1,22 @@ + +import codecs + +def parse_config(path): + f = codecs.open(path, "rb", "utf_8") + result = {} + + current_section = None + for line in f.readlines(): + line = line.strip() + if not line or line.startswith("#"): + continue + + if line.startswith("["): + current_section = line.replace("[", "").replace("]", "") + result[current_section] = [] + else: + if not current_section: + raise Exception("Line without section: %s" % line) + result[current_section].append(line) + + return result -- cgit v1.2.3