Lines 40-45
RE_ILLEGAL_XML = re.compile(u'[%s]' % u''.join((u'%s-%s' % \
|
Link Here
|
---|
|
40 |
(unichr(low), unichr(high)) for (low, high) in ILLEGAL_XML_UNICHR |
40 |
(unichr(low), unichr(high)) for (low, high) in ILLEGAL_XML_UNICHR |
41 |
if low < sys.maxunicode))) |
41 |
if low < sys.maxunicode))) |
42 |
|
42 |
|
|
|
43 |
|
43 |
class TestEnvironment(object): |
44 |
class TestEnvironment(object): |
44 |
"""Test environment for running test cases. |
45 |
"""Test environment for running test cases. |
45 |
|
46 |
|
Lines 156-162
class _TestReader(object): # pylint: disable-msg=R0903
|
Link Here
|
---|
|
156 |
while line: |
157 |
while line: |
157 |
self.digest.update(line) |
158 |
self.digest.update(line) |
158 |
line = self.stream.readline(size) |
159 |
line = self.stream.readline(size) |
159 |
|
160 |
|
160 |
|
161 |
|
161 |
class Verdict(object): |
162 |
class Verdict(object): |
162 |
""" |
163 |
""" |
Lines 493-498
class TestCase(object):
|
Link Here
|
---|
|
493 |
self.description = None |
494 |
self.description = None |
494 |
self.bugs = set() |
495 |
self.bugs = set() |
495 |
self.otrs = set() |
496 |
self.otrs = set() |
|
|
497 |
self.logfiles = set() |
496 |
|
498 |
|
497 |
def load(self, filename): |
499 |
def load(self, filename): |
498 |
""" |
500 |
""" |
Lines 525-530
class TestCase(object):
|
Link Here
|
---|
|
525 |
self.description = header.get('desc', '').strip() |
527 |
self.description = header.get('desc', '').strip() |
526 |
self.bugs = set(header.get('bugs', [])) |
528 |
self.bugs = set(header.get('bugs', [])) |
527 |
self.otrs = set(header.get('otrs', [])) |
529 |
self.otrs = set(header.get('otrs', [])) |
|
|
530 |
self.logfiles = set(header.get('logfiles', [])) |
528 |
self.versions = CheckVersion(header.get('versions', {})) |
531 |
self.versions = CheckVersion(header.get('versions', {})) |
529 |
self.tags = CheckTags(header.get('tags', [])) |
532 |
self.tags = CheckTags(header.get('tags', [])) |
530 |
self.roles = CheckRoles(header.get('roles', []), |
533 |
self.roles = CheckRoles(header.get('roles', []), |
Lines 626-631
class TestCase(object):
|
Link Here
|
---|
|
626 |
dirname = os.path.dirname(self.filename) |
629 |
dirname = os.path.dirname(self.filename) |
627 |
cmd = [self.exe.filename, base] + self.args |
630 |
cmd = [self.exe.filename, base] + self.args |
628 |
|
631 |
|
|
|
632 |
logfiles = {} |
633 |
for filename in self.logfiles: |
634 |
try: |
635 |
logfiles[filename] = open(filename, 'rb') |
636 |
except EnvironmentError: |
637 |
TestCase.logger.warn('Missing logfile %s' % (filename,)) |
638 |
|
629 |
time_start = time() |
639 |
time_start = time() |
630 |
|
640 |
|
631 |
# Protect wrapper from Ctrl-C as long as test case is running |
641 |
# Protect wrapper from Ctrl-C as long as test case is running |
Lines 638-643
class TestCase(object):
|
Link Here
|
---|
|
638 |
def prepare_child(): |
648 |
def prepare_child(): |
639 |
"""Setup child process.""" |
649 |
"""Setup child process.""" |
640 |
signal.signal(signal.SIGINT, signal.SIG_IGN) |
650 |
signal.signal(signal.SIGINT, signal.SIG_IGN) |
|
|
651 |
for logfile in logfiles.values(): |
652 |
logfile.close() |
641 |
|
653 |
|
642 |
try: |
654 |
try: |
643 |
TestCase.logger.debug('Running %r using %s in %s' % \ |
655 |
TestCase.logger.debug('Running %r using %s in %s' % \ |
Lines 681-686
class TestCase(object):
|
Link Here
|
---|
|
681 |
|
693 |
|
682 |
time_end = time() |
694 |
time_end = time() |
683 |
|
695 |
|
|
|
696 |
for filename in self.logfiles: |
697 |
if filename in logfiles: |
698 |
continue |
699 |
try: |
700 |
logfiles[filename] = open(filename, 'rb') |
701 |
except EnvironmentError: |
702 |
continue |
703 |
for filename, logfile in logfiles.iteritems(): |
704 |
base = os.path.basename(filename) |
705 |
content = logfile.read() |
706 |
TestCase._attach(result, base, content) |
707 |
logfile.close() |
708 |
|
684 |
result.duration = int(time_end * 1000.0 - time_start * 1000.0) |
709 |
result.duration = int(time_end * 1000.0 - time_start * 1000.0) |
685 |
TestCase.logger.info('Test %r using %s in %s returned %s in %s ms' % \ |
710 |
TestCase.logger.info('Test %r using %s in %s returned %s in %s ms' % \ |
686 |
(cmd, self.exe, dirname, result.result, result.duration)) |
711 |
(cmd, self.exe, dirname, result.result, result.duration)) |