本文整理匯總了Python中qibuild.test.conftest.TestBuildWorkTree類的典型用法代碼示例。如果您正苦於以下問題:Python TestBuildWorkTree類的具體用法?Python TestBuildWorkTree怎麽用?Python TestBuildWorkTree使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TestBuildWorkTree類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_default_config
def test_set_default_config(cd_to_tmpdir):
qibuild.config.add_build_config("foo")
build_worktree = TestBuildWorkTree()
build_worktree.set_default_config("foo")
assert build_worktree.default_config == "foo"
build_worktree2 = TestBuildWorkTree()
assert build_worktree2.default_config == "foo"
示例2: test_simple
def test_simple(qilinguist_action, record_messages):
""" Test Simple """
build_worktree = TestBuildWorkTree()
build_worktree.add_test_project("translateme/qt")
qilinguist_action("list")
assert record_messages.find("\\*\\s+helloqt")
assert record_messages.find("\\*\\s+translate")
示例3: test_qt
def test_qt(qilinguist_action):
build_worktree = TestBuildWorkTree()
project = build_worktree.add_test_project("translateme/qt")
try:
project.configure()
except Exception:
print "Qt not installed, skipping"
return
project.build()
qilinguist_action("update", "helloqt")
# Translate in French:
fr_ts = os.path.join(project.path, "po", "fr_FR.ts")
tree = qisys.qixml.read(fr_ts)
root = tree.getroot()
tr_elem = root.find("context/message/translation")
assert tr_elem is not None
tr_elem.attrib.clear()
tr_elem.text = "Bonjour, monde"
qisys.qixml.write(root, fr_ts)
qilinguist_action("release", "helloqt")
translateme = qibuild.find.find([project.sdk_directory], "translateme")
cmd = [translateme,
os.path.join(project.path, "po"),
"fr_FR"]
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
(out, _) = process.communicate()
assert "Bonjour, monde" in out
示例4: test_set_pythonhome
def test_set_pythonhome(toolchains, cd_to_tmpdir):
toolchains.create("foo")
qibuild.config.add_build_config("foo", toolchain="foo")
python_package = toolchains.add_package("foo", "python")
build_worktree = TestBuildWorkTree()
build_worktree.set_active_config("foo")
env = build_worktree.get_env()
assert env["PYTHONHOME"] == python_package.path
示例5: test_profiles_from_config
def test_profiles_from_config(cd_to_tmpdir):
qibuild.config.add_build_config("foo", profiles=["bar"])
build_worktree = TestBuildWorkTree()
local_xml = build_worktree.qibuild_xml
qibuild.profile.configure_build_profile(local_xml, "bar", [("WITH_BAR", "ON")])
build_worktree.set_active_config("foo")
build_config = build_worktree.build_config
assert build_config.profiles == ["bar"]
assert build_config.cmake_args == ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_BAR=ON"]
示例6: test_when_is_default
def test_when_is_default(qitoolchain_action):
""" Test When Is Default """
qitoolchain_action("create", "foo")
qibuild.config.add_build_config("foo", toolchain="foo")
test_build_worktre1 = TestBuildWorkTree()
test_build_worktre1.set_default_config("foo")
qitoolchain_action("remove", "foo", "--force")
test_build_worktre2 = TestBuildWorkTree()
with pytest.raises(Exception) as e:
test_build_worktre2.toolchain # pylint:disable=pointless-statement
assert "No such toolchain" in e.value.message
示例7: test_when_is_default
def test_when_is_default(qitoolchain_action):
qitoolchain_action("create", "foo")
qibuild.config.add_build_config("foo", toolchain="foo")
test_build_worktre1 = TestBuildWorkTree()
test_build_worktre1.set_default_config("foo")
qitoolchain_action("remove", "foo", "--force")
test_build_worktre2 = TestBuildWorkTree()
# pylint:disable-msg=E1101
with pytest.raises(Exception) as e:
test_build_worktre2.toolchain
assert "No such toolchain" in e.value.message
示例8: test_set_pythonhome
def test_set_pythonhome(toolchains, cd_to_tmpdir):
toolchains.create("foo")
qibuild.config.add_build_config("foo", toolchain="foo")
python_package = toolchains.add_package("foo", "python")
build_worktree = TestBuildWorkTree()
build_worktree.set_active_config("foo")
env = build_worktree.get_env()
if sys.platform == "darwin":
assert env["PYTHONHOME"] == python_package.path + "/Python.framework/Versions/2.7"
else:
assert env["PYTHONHOME"] == python_package.path
示例9: test_using_custom_profile
def test_using_custom_profile(qibuild_action, qisrc_action, git_server):
git_server.add_build_profile("foo", [("WITH_FOO", "ON")])
qisrc_action("init", git_server.manifest_url)
build_worktree = TestBuildWorkTree()
qibuild_xml = build_worktree.qibuild_xml
qibuild.profile.configure_build_profile(qibuild_xml, "bar", [("WITH_BAR", "ON")])
build_worktree.create_project("spam")
qibuild.config.add_build_config("foo", profiles=["foo"])
qibuild.config.add_build_config("bar", profiles=["bar"])
qibuild_action("configure", "spam", "--config", "foo", "--summarize-options")
qibuild_action("configure", "spam", "--config", "bar", "--summarize-options")
示例10: test_pure_c_project
def test_pure_c_project(qibuild_action, tmpdir):
""" Test Pure C Project """
work = tmpdir.join("work")
foo1 = work.mkdir("foo")
foo1.join("CMakeLists.txt").write("""\ncmake_minimum_required(VERSION 3.0)\nproject(foo C)\n""")
qibuild_action.chdir(foo1.strpath)
qibuild_action("convert", "--go")
qibuild_action.chdir(work.strpath)
build_worktree = TestBuildWorkTree()
worktree = build_worktree.worktree
worktree.add_project("foo")
assert build_worktree.get_build_project("foo")
示例11: test_bad_qibuild_config_with_qitest_json
def test_bad_qibuild_config_with_qitest_json(args, qibuild_action, monkeypatch):
qibuild_action.add_test_project("testme")
qibuild_action("add-config", "foo")
qibuild_action("configure", "--config", "foo", "testme")
build_worktree = TestBuildWorkTree()
build_worktree.set_active_config("foo")
testme_proj = build_worktree.get_build_project("testme")
testme_sdk = testme_proj.sdk_directory
qitest_json = os.path.join(testme_sdk, "qitest.json")
monkeypatch.chdir(testme_proj.path)
args.qitest_jsons = [qitest_json]
test_runners = qitest.parsers.get_test_runners(args)
示例12: test_profiles_from_config
def test_profiles_from_config(cd_to_tmpdir):
""" Test Profiles From Config """
qibuild.config.add_build_config("foo", profiles=["bar"])
build_worktree = TestBuildWorkTree()
local_xml = build_worktree.qibuild_xml
qibuild.profile.configure_build_profile(local_xml, "bar", [("WITH_BAR", "ON")])
build_worktree.set_active_config("foo")
build_config = build_worktree.build_config
assert build_config.profiles == ["bar"]
cmake_args = build_config.cmake_args
cmake_args = [x for x in cmake_args if "VIRTUALENV" not in x]
assert cmake_args == ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_BAR=ON"]
示例13: test_warns_on_conflict
def test_warns_on_conflict(qibuild_action, qisrc_action, git_server,
record_messages):
git_server.add_build_profile("foo", [("WITH_FOO", "ON")])
qisrc_action("init", git_server.manifest_url)
build_worktree = TestBuildWorkTree()
qibuild_xml = build_worktree.qibuild_xml
qibuild.profile.configure_build_profile(qibuild_xml, "foo", [("WITH_FOO", "OFF")])
build_worktree.create_project("spam")
qibuild.config.add_build_config("foo", profiles=["foo"])
record_messages.reset()
qibuild_action("configure", "spam", "--config", "foo", "--summarize-options")
assert record_messages.find("WITH_FOO\s+: OFF")
assert record_messages.find("WARN")
示例14: test_no_duplicate_deps
def test_no_duplicate_deps(cd_to_tmpdir, args):
args.dep_types = "default"
build_worktree = TestBuildWorkTree()
foo = build_worktree.create_project("foo", run_depends=["bar"])
build_worktree.create_project("bar", src="foo/bar")
git = qisrc.git.Git(foo.path)
git.init()
git_worktree = TestGitWorkTree()
with qisys.sh.change_cwd(cd_to_tmpdir.join("foo").strpath):
projs = get_git_projects(git_worktree, args, default_all=True,
use_build_deps=True)
assert projs == [foo]
示例15: test_using_fake_ctc
def test_using_fake_ctc(qibuild_action, fake_ctc):
""" Test Using Fake Cross Toolchain """
qibuild_action.add_test_project("footool")
qibuild_action("configure", "footool", "--config", "fake-ctc")
qibuild_action("make", "footool", "--config", "fake-ctc")
build_worktree = TestBuildWorkTree()
build_worktree.set_active_config("fake-ctc")
footool_proj = build_worktree.get_build_project("footool")
# assert that bin/footool exists but cannot be run:
footool = qibuild.find.find_bin([footool_proj.sdk_directory], "footool",
expect_one=True)
assert os.path.exists(footool)
with pytest.raises(Exception):
qisys.command.call([footool])