From 6a3d3aaaf2aebb816c7287263c8097844280b233 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 1 May 2021 22:38:55 -0400 Subject: refactor: move exceptions to their own module --- coverage/exceptions.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 coverage/exceptions.py (limited to 'coverage/exceptions.py') diff --git a/coverage/exceptions.py b/coverage/exceptions.py new file mode 100644 index 00000000..ed96fb21 --- /dev/null +++ b/coverage/exceptions.py @@ -0,0 +1,48 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +"""Exceptions coverage.py can raise.""" + + +class BaseCoverageException(Exception): + """The base of all Coverage exceptions.""" + pass + + +class CoverageException(BaseCoverageException): + """An exception raised by a coverage.py function.""" + pass + + +class NoSource(CoverageException): + """We couldn't find the source for a module.""" + pass + + +class NoCode(NoSource): + """We couldn't find any code at all.""" + pass + + +class NotPython(CoverageException): + """A source file turned out not to be parsable Python.""" + pass + + +class ExceptionDuringRun(CoverageException): + """An exception happened while running customer code. + + Construct it with three arguments, the values from `sys.exc_info`. + + """ + pass + + +class StopEverything(BaseCoverageException): + """An exception that means everything should stop. + + The CoverageTest class converts these to SkipTest, so that when running + tests, raising this exception will automatically skip the test. + + """ + pass -- cgit v1.2.1