view upreckon/exceptions.py @ 174:e0b2fbd7ebe0

Improved built-in output validator; added conf. var. binary The built-in output validator now reads blocks rather than lines, which should make it faster. There is also a new configuration variable called binary, which defaults to False and specifies whether the built-in output validator should not try to translate line breaks. Finally, when binary is false, the built-in output validator now translates line breaks even if it the reference output is in a tape archive.
author Oleg Oshmyan <chortos@inbox.lv>
date Sat, 18 Jun 2011 02:55:17 +0100
parents d5b6708c1955
children 65b5c9390010
line wrap: on
line source

# Copyright (c) 2010-2011 Chortos-2 <chortos@inbox.lv>

__all__ = ('TestCaseNotPassed', 'TestCaseSkipped', 'TimeLimitExceeded',
           'CPUTimeLimitExceeded', 'WallTimeLimitExceeded',
           'MemoryLimitExceeded', 'CanceledByUser', 'WrongAnswer',
           'NonZeroExitCode', 'ExceptionWrapper', 'CannotStartTestee',
           'CannotStartValidator', 'CannotReadOutputFile',
           'CannotReadInputFile', 'CannotReadAnswerFile')

class TestCaseNotPassed(Exception): __slots__ = ()
class TestCaseSkipped(TestCaseNotPassed): __slots__ = ()
class TimeLimitExceeded(TestCaseNotPassed): __slots__ = ()
class CPUTimeLimitExceeded(TimeLimitExceeded): __slots__ = ()
class WallTimeLimitExceeded(TimeLimitExceeded): __slots__ = ()
class MemoryLimitExceeded(TestCaseNotPassed): __slots__ = ()
class CanceledByUser(TestCaseNotPassed): __slots__ = ()

class WrongAnswer(TestCaseNotPassed):
	__slots__ = 'comment'
	def __init__(self, comment=''):
		self.comment = comment

class NonZeroExitCode(TestCaseNotPassed):
	__slots__ = 'exitcode'
	def __init__(self, exitcode):
		self.exitcode = exitcode

class ExceptionWrapper(TestCaseNotPassed):
	__slots__ = 'upstream'
	def __init__(self, upstream):
		self.upstream = upstream

class CannotStartTestee(ExceptionWrapper): __slots__ = ()
class CannotStartValidator(ExceptionWrapper): __slots__ = ()
class CannotReadOutputFile(ExceptionWrapper): __slots__ = ()
class CannotReadInputFile(ExceptionWrapper): __slots__ = ()
class CannotReadAnswerFile(ExceptionWrapper): __slots__ = ()