Kevin Cheng | 8b2c94c | 2017-12-18 14:43:26 -0800 | [diff] [blame] | 1 | # Copyright 2018, The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | """ |
| 16 | atest exceptions. |
| 17 | """ |
| 18 | |
| 19 | |
| 20 | class UnsupportedModuleTestError(Exception): |
| 21 | """Error raised when we find a module that we don't support.""" |
| 22 | |
| 23 | class TestDiscoveryException(Exception): |
| 24 | """Base Exception for issues with test discovery.""" |
| 25 | |
| 26 | class NoTestFoundError(TestDiscoveryException): |
| 27 | """Raised when no tests are found.""" |
| 28 | |
| 29 | class TestWithNoModuleError(TestDiscoveryException): |
| 30 | """Raised when test files have no parent module directory.""" |
| 31 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 32 | class MissingPackageNameError(TestDiscoveryException): |
Kevin Cheng | 8b2c94c | 2017-12-18 14:43:26 -0800 | [diff] [blame] | 33 | """Raised when the test class java file does not contain a package name.""" |
| 34 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 35 | class TooManyMethodsError(TestDiscoveryException): |
Kevin Cheng | 8b2c94c | 2017-12-18 14:43:26 -0800 | [diff] [blame] | 36 | """Raised when input string contains more than one # character.""" |
| 37 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 38 | class MethodWithoutClassError(TestDiscoveryException): |
mikehoran | 6740a41 | 2018-02-20 15:04:16 -0800 | [diff] [blame] | 39 | """Raised when method is appended via # but no class file specified.""" |
| 40 | |
Kevin Cheng | 8b2c94c | 2017-12-18 14:43:26 -0800 | [diff] [blame] | 41 | class UnknownTestRunnerError(Exception): |
| 42 | """Raised when an unknown test runner is specified.""" |
| 43 | |
| 44 | class NoTestRunnerName(Exception): |
| 45 | """Raised when Test Runner class var NAME isn't defined.""" |
| 46 | |
| 47 | class NoTestRunnerExecutable(Exception): |
| 48 | """Raised when Test Runner class var EXECUTABLE isn't defined.""" |
| 49 | |
| 50 | class HostEnvCheckFailed(Exception): |
| 51 | """Raised when Test Runner's host env check fails.""" |
| 52 | |
| 53 | class ShouldNeverBeCalledError(Exception): |
| 54 | """Raised when something is called when it shouldn't, used for testing.""" |
| 55 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 56 | class FatalIncludeError(TestDiscoveryException): |
Kevin Cheng | 8b2c94c | 2017-12-18 14:43:26 -0800 | [diff] [blame] | 57 | """Raised if expanding include tag fails.""" |
kellyhung | f4b5947 | 2018-05-10 17:00:10 +0800 | [diff] [blame] | 58 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 59 | class MissingCCTestCaseError(TestDiscoveryException): |
kellyhung | f4b5947 | 2018-05-10 17:00:10 +0800 | [diff] [blame] | 60 | """Raised when the cc file does not contain a test case class.""" |
kellyhung | d69de38 | 2018-08-07 18:32:58 +0800 | [diff] [blame] | 61 | |
nelsonli | c4a7145 | 2018-09-13 14:10:30 +0800 | [diff] [blame] | 62 | class XmlNotExistError(TestDiscoveryException): |
kellyhung | d69de38 | 2018-08-07 18:32:58 +0800 | [diff] [blame] | 63 | """Raised when the xml file does not exist.""" |
yangbill | bac1dd6 | 2019-06-03 17:06:40 +0800 | [diff] [blame] | 64 | |
| 65 | class DryRunVerificationError(Exception): |
| 66 | """Base Exception if verification fail.""" |