summaryrefslogtreecommitdiff
path: root/tests/compare.py
diff options
context:
space:
mode:
authorMiguelangel Jose Freitas Loreto <miguelangel.freitas@gmail.com>2009-07-04 21:02:41 -0330
committerDmitry Bogatov <KAction@debian.org>2018-12-02 05:36:56 +0000
commitd42e9428681c357ae0cd1923f5f336c12551812f (patch)
treecb6ddd8abd722cb8c9740dadf43bc55e22c5c743 /tests/compare.py
parent31d17b652382f9c0903cf339b1722350b65f2081 (diff)
parent11470c63662bffe68b6b5fbfccdf5f34d208bcb6 (diff)
Import Debian changes 6.5-1
dtrx (6.5-1) unstable; urgency=low * New upstram release. * Ready to build with python 2.6, thanks Alessio Treglia (Closes: #526996) * debian/rules: - -include /usr/share/python/python.mk. - Append $(py_setup_install_args) to install arguments. * debian/control: - Standards-Version: 3.8.2 - B-D-I: Add rst2man to build upstream manpage. * Remove debian/dtrx.1, using README file instead.
Diffstat (limited to 'tests/compare.py')
-rw-r--r--tests/compare.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/compare.py b/tests/compare.py
index cdbcc5d..7927467 100644
--- a/tests/compare.py
+++ b/tests/compare.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
#
# compare.py -- High-level tests for dtrx.
-# Copyright (c) 2006, 2007, 2008 Brett Smith <brettcsmith@brettcsmith.org>.
+# Copyright © 2006-2009 Brett Smith <brettcsmith@brettcsmith.org>.
#
# 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
@@ -54,8 +55,13 @@ class ExtractorTest(object):
setattr(self, 'options', kwargs.get('options', '-n').split())
setattr(self, 'filenames', kwargs.get('filenames', '').split())
for key in ('directory', 'prerun', 'posttest', 'baseline', 'error',
- 'grep', 'antigrep', 'input', 'output', 'cleanup'):
+ 'input', 'output', 'cleanup'):
setattr(self, key, kwargs.get(key, None))
+ for key in ('grep', 'antigrep'):
+ value = kwargs.get(key, [])
+ if isinstance(value, str):
+ value = [value]
+ setattr(self, key, value)
def get_results(self, commands, stdin=None):
print >>output_buffer, "Output from %s:" % (' '.join(commands),)
@@ -165,12 +171,13 @@ class ExtractorTest(object):
return None
def grep_output(self, output):
- if self.grep and (not re.search(self.grep.replace(' ', '\\s+'),
- output, re.MULTILINE)):
- return "output did not match %s" % (self.grep)
- elif self.antigrep and re.search(self.antigrep.replace(' ', '\\s+'),
- output, re.MULTILINE):
- return "output matched antigrep %s" % (self.antigrep)
+ for pattern in self.grep:
+ if not re.search(pattern.replace(' ', '\\s+'), output,
+ re.MULTILINE):
+ return "output did not match %s" % (pattern)
+ for pattern in self.antigrep:
+ if re.search(pattern.replace(' ', '\\s+'), output, re.MULTILINE):
+ return "output matched antigrep %s" % (self.antigrep)
return None
def check_output(self, output):