diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-10-06 23:42:37 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-02-01 17:01:30 -0500 |
commit | a21af43200e13fa65e12bdbe5116a0cecc4990b3 (patch) | |
tree | 4db989be7c51dd745fa17e09b60d64f64f6f6bcc /mesonbuild/mtest.py | |
parent | 680b5ff819bf36397ea560f802510bce5b83f6bc (diff) | |
download | meson-a21af43200e13fa65e12bdbe5116a0cecc4990b3.zip meson-a21af43200e13fa65e12bdbe5116a0cecc4990b3.tar.gz meson-a21af43200e13fa65e12bdbe5116a0cecc4990b3.tar.bz2 |
micro-optimize: define typing-only objects in TYPE_CHECKING
Union types that exist solely for use as annotations don't need to be
created in normal runs.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index a46125d..1feb205 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -51,6 +51,15 @@ from .mintro import get_infodir, load_info_file from .programs import ExternalProgram from .backend.backends import TestProtocol, TestSerialisation +if T.TYPE_CHECKING: + TYPE_TAPResult = T.Union['TAPParser.Test', + 'TAPParser.Error', + 'TAPParser.Version', + 'TAPParser.Plan', + 'TAPParser.UnknownLine', + 'TAPParser.Bailout'] + + # GNU autotools interprets a return code of 77 from tests it executes to # mean that the test should be skipped. GNU_SKIP_RETURNCODE = 77 @@ -272,13 +281,6 @@ class TestResult(enum.Enum): return str(self.colorize('>>> ')) -TYPE_TAPResult = T.Union['TAPParser.Test', - 'TAPParser.Error', - 'TAPParser.Version', - 'TAPParser.Plan', - 'TAPParser.UnknownLine', - 'TAPParser.Bailout'] - class TAPParser: class Plan(T.NamedTuple): num_tests: int |