<s> import os <EOL> import qisys . error <EOL> import qibuild . cmake_builder <EOL> import qibuild . config <EOL> import qibuild . parsers <EOL> import mock <EOL> import pytest <EOL> from qisrc . test . conftest import git_server , qisrc_action <EOL> from qibuild . test . conftest import TestBuildWorkTree <EOL> def test_check_configure_has_been_called_before_building ( build_worktree ) : <EOL> hello_proj = build_worktree . create_project ( "<STR_LIT:hello>" ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree , [ hello_proj ] ) <EOL> with pytest . raises ( qibuild . cmake_builder . NotConfigured ) : <EOL> cmake_builder . build ( ) <EOL> def test_default_install ( build_worktree , toolchains , tmpdir ) : <EOL> hello_proj = build_worktree . create_project ( "<STR_LIT:hello>" , run_depends = "<STR_LIT:bar>" ) <EOL> toolchains . create ( "<STR_LIT:foo>" ) <EOL> qibuild . config . add_build_config ( "<STR_LIT:foo>" , toolchain = "<STR_LIT:foo>" ) <EOL> build_worktree . set_active_config ( "<STR_LIT:foo>" ) <EOL> toolchains . add_package ( "<STR_LIT:foo>" , "<STR_LIT:bar>" ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree , [ hello_proj ] ) <EOL> cmake_builder . configure ( ) <EOL> cmake_builder . build ( ) <EOL> cmake_builder . install ( tmpdir . strpath ) <EOL> def test_runtime_single ( build_worktree , args ) : <EOL> build_worktree . create_project ( "<STR_LIT:hello>" , run_depends = "<STR_LIT:bar>" ) <EOL> args . projects = [ "<STR_LIT:hello>" ] <EOL> args . runtime_only = True <EOL> args . single = True <EOL> cmake_builder = qibuild . parsers . get_cmake_builder ( args ) <EOL> assert cmake_builder . dep_types == [ ] <EOL> def test_sdk_dirs ( build_worktree ) : <EOL> foo_proj = build_worktree . create_project ( "<STR_LIT:foo>" ) <EOL> bar_proj = build_worktree . create_project ( "<STR_LIT:bar>" , build_depends = [ "<STR_LIT:foo>" ] ) <EOL> baz_proj = build_worktree . create_project ( "<STR_LIT>" , build_depends = [ "<STR_LIT:bar>" ] ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree , [ bar_proj ] ) <EOL> sdk_dirs_when_top_project = cmake_builder . get_sdk_dirs_for_project ( bar_proj ) <EOL> cmake_builder . projects = [ baz_proj ] <EOL> sdk_dirs_when_not_top_project = cmake_builder . get_sdk_dirs_for_project ( bar_proj ) <EOL> assert sdk_dirs_when_top_project == sdk_dirs_when_not_top_project <EOL> def test_add_package_paths_from_toolchain ( build_worktree , toolchains , monkeypatch ) : <EOL> toolchains . create ( "<STR_LIT:test>" ) <EOL> qibuild . config . add_build_config ( "<STR_LIT:test>" , toolchain = "<STR_LIT:test>" ) <EOL> boost_package = toolchains . add_package ( "<STR_LIT:test>" , "<STR_LIT>" ) <EOL> pthread_package = toolchains . add_package ( "<STR_LIT:test>" , "<STR_LIT>" ) <EOL> qi_package = toolchains . add_package ( "<STR_LIT:test>" , "<STR_LIT>" , build_depends = [ "<STR_LIT>" ] ) <EOL> naoqi_proj = build_worktree . create_project ( "<STR_LIT>" , build_depends = [ "<STR_LIT>" ] ) <EOL> build_worktree . set_active_config ( "<STR_LIT:test>" ) <EOL> os . environ [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree , [ naoqi_proj ] ) <EOL> sdk_dirs = cmake_builder . get_sdk_dirs_for_project ( naoqi_proj ) <EOL> assert sdk_dirs == [ boost_package . path , qi_package . path , pthread_package . path ] <EOL> del os . environ [ "<STR_LIT>" ] <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree , [ naoqi_proj ] ) <EOL> sdk_dirs = cmake_builder . get_sdk_dirs_for_project ( naoqi_proj ) <EOL> assert sdk_dirs == [ boost_package . path , qi_package . path ] <EOL> def test_host_tools_happy_path ( build_worktree , fake_ctc ) : <EOL> footool = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> footool . configure ( ) <EOL> host_sdk_dir = footool . sdk_directory <EOL> usefootool_proj = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> build_worktree . set_active_config ( "<STR_LIT>" ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree ) <EOL> host_dirs = cmake_builder . get_host_dirs ( usefootool_proj ) <EOL> assert host_dirs == [ host_sdk_dir ] <EOL> def test_host_tools_no_host_config ( build_worktree , fake_ctc ) : <EOL> footool = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> usefootool_proj = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> build_worktree . set_active_config ( "<STR_LIT>" ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree ) <EOL> with pytest . raises ( qisys . error . Error ) as e : <EOL> cmake_builder . get_host_dirs ( usefootool_proj ) <EOL> assert "<STR_LIT>" in e . value . message <EOL> def test_host_tools_host_tools_not_built ( build_worktree , fake_ctc ) : <EOL> qibuild . config . add_build_config ( "<STR_LIT:foo>" , host = True ) <EOL> footool = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> usefootool_proj = build_worktree . add_test_project ( "<STR_LIT>" ) <EOL> build_worktree . set_active_config ( "<STR_LIT>" ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree ) <EOL> with pytest . raises ( qisys . error . Error ) as e : <EOL> cmake_builder . get_host_dirs ( usefootool_proj ) <EOL> assert "<STR_LIT>" in e . value . message <EOL> def test_setting_loose_deps_resolution_from_manifest ( git_server , qisrc_action ) : <EOL> git_server . set_loose_deps_resolution ( ) <EOL> qisrc_action ( "<STR_LIT>" , git_server . manifest_url ) <EOL> build_worktree = TestBuildWorkTree ( ) <EOL> cmake_builder = qibuild . cmake_builder . CMakeBuilder ( build_worktree ) <EOL> assert cmake_builder . loose_deps_resolution == True </s>
