summaryrefslogtreecommitdiff
path: root/unittests/internaltests.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-06 23:29:27 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-06-26 13:10:33 -0400
commita1ef957e349583f9affdce5b5a4f094860e91037 (patch)
tree01e0fd479c9b5c47b63b779bfb698e6c0785df4e /unittests/internaltests.py
parent6fad02db04534519e96f1ba66a178c6c9735554f (diff)
downloadmeson-a1ef957e349583f9affdce5b5a4f094860e91037.tar.gz
linkers: delay implementations import until detect is run
This saves on a 1500-line import at startup and may be skipped entirely if no compiled languages are used. In exchange, we move the implementation to a new file that is imported instead. Followup to commit ab20eb5bbc21ae855bcd211131132d2778602bcf.
Diffstat (limited to 'unittests/internaltests.py')
-rw-r--r--unittests/internaltests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/unittests/internaltests.py b/unittests/internaltests.py
index 6f04d9415..f22adb2f9 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -38,6 +38,7 @@ from mesonbuild import coredata
from mesonbuild.compilers.c import ClangCCompiler, GnuCCompiler
from mesonbuild.compilers.cpp import VisualStudioCPPCompiler
from mesonbuild.compilers.d import DmdDCompiler
+from mesonbuild.linkers import linkers
from mesonbuild.interpreterbase import typed_pos_args, InvalidArguments, ObjectHolder
from mesonbuild.interpreterbase import typed_pos_args, InvalidArguments, typed_kwargs, ContainerTypeInfo, KwargInfo
from mesonbuild.mesonlib import (
@@ -223,7 +224,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_class_visualstudio(self):
- linker = mesonbuild.linkers.MSVCDynamicLinker(MachineChoice.HOST, [])
+ linker = linkers.MSVCDynamicLinker(MachineChoice.HOST, [])
# Version just needs to be > 19.0.0
cc = VisualStudioCPPCompiler([], [], '20.00', MachineChoice.HOST, False, mock.Mock(), 'x64', linker=linker)
@@ -245,7 +246,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_class_gnuld(self):
## Test --start/end-group
- linker = mesonbuild.linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
+ linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
## Ensure that the fake compiler is never called by overriding the relevant function
gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
@@ -273,7 +274,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_remove_system(self):
## Test --start/end-group
- linker = mesonbuild.linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
+ linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
## Ensure that the fake compiler is never called by overriding the relevant function
gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']