annotate upreckon/exceptions.py @ 146:d5b6708c1955

Distutils support, reorganization and cleaning up * Removed command-line options -t and -u. * Reorganized code: o all modules are now in package upreckon; o TestCaseNotPassed and its descendants now live in a separate module exceptions; o load_problem now lives in module problem. * Commented out mentions of command-line option -c in --help. * Added a distutils-based setup.py.
author Oleg Oshmyan <chortos@inbox.lv>
date Sat, 28 May 2011 14:24:25 +0100
parents
children 65b5c9390010
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
146
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
1 # Copyright (c) 2010-2011 Chortos-2 <chortos@inbox.lv>
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
2
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
3 __all__ = ('TestCaseNotPassed', 'TestCaseSkipped', 'TimeLimitExceeded',
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
4 'CPUTimeLimitExceeded', 'WallTimeLimitExceeded',
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
5 'MemoryLimitExceeded', 'CanceledByUser', 'WrongAnswer',
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
6 'NonZeroExitCode', 'ExceptionWrapper', 'CannotStartTestee',
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
7 'CannotStartValidator', 'CannotReadOutputFile',
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
8 'CannotReadInputFile', 'CannotReadAnswerFile')
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
9
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
10 class TestCaseNotPassed(Exception): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
11 class TestCaseSkipped(TestCaseNotPassed): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
12 class TimeLimitExceeded(TestCaseNotPassed): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
13 class CPUTimeLimitExceeded(TimeLimitExceeded): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
14 class WallTimeLimitExceeded(TimeLimitExceeded): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
15 class MemoryLimitExceeded(TestCaseNotPassed): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
16 class CanceledByUser(TestCaseNotPassed): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
17
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
18 class WrongAnswer(TestCaseNotPassed):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
19 __slots__ = 'comment'
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
20 def __init__(self, comment=''):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
21 self.comment = comment
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
22
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
23 class NonZeroExitCode(TestCaseNotPassed):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
24 __slots__ = 'exitcode'
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
25 def __init__(self, exitcode):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
26 self.exitcode = exitcode
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
27
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
28 class ExceptionWrapper(TestCaseNotPassed):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
29 __slots__ = 'upstream'
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
30 def __init__(self, upstream):
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
31 self.upstream = upstream
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
32
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
33 class CannotStartTestee(ExceptionWrapper): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
34 class CannotStartValidator(ExceptionWrapper): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
35 class CannotReadOutputFile(ExceptionWrapper): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
36 class CannotReadInputFile(ExceptionWrapper): __slots__ = ()
d5b6708c1955 Distutils support, reorganization and cleaning up
Oleg Oshmyan <chortos@inbox.lv>
parents:
diff changeset
37 class CannotReadAnswerFile(ExceptionWrapper): __slots__ = ()