diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-01-28 09:20:26 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-01-29 09:11:24 -0800 |
commit | 751f6fb90f41f1e633b28ca60f6cde2f4c204da3 (patch) | |
tree | 3b3660554715249d1507747d634d0c4e37bf3b25 /run_unittests.py | |
parent | af4acc8e05fdeed2e67c5fea60461fb6748e42cc (diff) | |
download | meson-751f6fb90f41f1e633b28ca60f6cde2f4c204da3.zip meson-751f6fb90f41f1e633b28ca60f6cde2f4c204da3.tar.gz meson-751f6fb90f41f1e633b28ca60f6cde2f4c204da3.tar.bz2 |
run_unitests: Add a test for DependencyFactory ordering
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 7ed3f7c..a750b81 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -43,6 +43,7 @@ from distutils.dir_util import copy_tree import mesonbuild.mlog import mesonbuild.depfile +import mesonbuild.dependencies.base import mesonbuild.compilers import mesonbuild.envconfig import mesonbuild.environment @@ -1201,6 +1202,26 @@ class InternalTests(unittest.TestCase): ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/libdata/pkgconfig']), ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib']) + def test_dependency_factory_order(self): + b = mesonbuild.dependencies.base + with tempfile.TemporaryDirectory() as tmpdir: + with chdir(tmpdir): + env = get_fake_env() + + f = b.DependencyFactory( + 'test_dep', + methods=[b.DependencyMethods.PKGCONFIG, b.DependencyMethods.CMAKE] + ) + actual = [m() for m in f(env, MachineChoice.HOST, {'required': False})] + self.assertListEqual([m.type_name for m in actual], ['pkgconfig', 'cmake']) + + f = b.DependencyFactory( + 'test_dep', + methods=[b.DependencyMethods.CMAKE, b.DependencyMethods.PKGCONFIG] + ) + actual = [m() for m in f(env, MachineChoice.HOST, {'required': False})] + self.assertListEqual([m.type_name for m in actual], ['cmake', 'pkgconfig']) + @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') class DataTests(unittest.TestCase): |