def test_simple(qitoolchain_action, svn_server, feed, record_messages): """ Test Simple """ toolchain = qitoolchain.toolchain.Toolchain("foo") boost_url = svn_server.create_repo("boost") svn_server.commit_file("boost", "version.hpp", "") qt_url = svn_server.create_repo("qt") boost_package = qitoolchain.svn_package.SvnPackage("boost") boost_package.url = boost_url qt_package = qitoolchain.svn_package.SvnPackage("qt") qt_package.url = qt_url feed.add_svn_package(boost_package) feed.add_svn_package(qt_package) toolchain.update(feed.url) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc == 0 assert not record_messages.find("qt") assert not record_messages.find("boost") assert record_messages.find("All OK") # Now create a problem in the svn repo: boost_path = toolchain.get_package("boost").path version_hpp = os.path.join(boost_path, "version.hpp") os.remove(version_hpp) record_messages.reset() rc = qitoolchain_action("svn-status", "foo", retcode=True) assert rc != 0 assert record_messages.find("boost") assert record_messages.find("version.hpp")
def test_run_last_failed(tmpdir, qitest_action, record_messages): """ Test Run Last Failed """ test_one = tmpdir.join("test_one.py") test_one.write("import sys; sys.exit(1)") test_two = tmpdir.join("test_two.py") test_two.write("") qitest_json = tmpdir.join("qitest.json") tests = [ { "name": "test_one", "cmd": [sys.executable, test_one.strpath], "timeout": 1 }, { "name": "test_two", "cmd": [sys.executable, test_two.strpath], "timeout": 1 }, ] qitest_json.write(json.dumps(tests)) qitest_action.chdir(tmpdir) qitest_action("run", retcode=True) record_messages.reset() qitest_action("run", "--last-failed", retcode=True) assert not record_messages.find(r"\(2/2\) test_two") assert record_messages.find(r"\(1/1\) test_one") test_one.write("") record_messages.reset() qitest_action("run", "--last-failed", retcode=True) qitest_action("run", "--last-failed", retcode=True) assert record_messages.find("No failing tests found")
def test_simple(qitest_action, tmpdir, record_messages): """ Test Simple """ tests = [ {"name": "foo", "gtest": True}, {"name": "test_bar"}, {"name": "test_baz", "pytest": True} ] qitest_json = tmpdir.join("qitest.json") qitest_json.write(json.dumps(tests)) qitest_action("list", cwd=tmpdir.strpath) assert record_messages.find(r"foo.*\(invalid name\)") assert record_messages.find(r"test_bar.*\(no type\)")
def test_run_last_failed(tmpdir, qitest_action, record_messages): """ Test Run Last Failed """ test_one = tmpdir.join("test_one.py") test_one.write("import sys; sys.exit(1)") test_two = tmpdir.join("test_two.py") test_two.write("") qitest_json = tmpdir.join("qitest.json") tests = [ {"name": "test_one", "cmd": [sys.executable, test_one.strpath], "timeout": 1}, {"name": "test_two", "cmd": [sys.executable, test_two.strpath], "timeout": 1}, ] qitest_json.write(json.dumps(tests)) qitest_action.chdir(tmpdir) qitest_action("run", retcode=True) record_messages.reset() qitest_action("run", "--last-failed", retcode=True) assert not record_messages.find(r"\(2/2\) test_two") assert record_messages.find(r"\(1/1\) test_one") test_one.write("") record_messages.reset() qitest_action("run", "--last-failed", retcode=True) qitest_action("run", "--last-failed", retcode=True) assert record_messages.find("No failing tests found")
def test_simple(qitoolchain_action, record_messages): """ Test Simple """ qitoolchain_action("create", "foo") qitoolchain_action("create", "bar") qibuild.config.add_build_config("foo", toolchain="foo") world_package = qitoolchain_action.get_test_package("world") qitoolchain_action("add-package", "-c", "foo", world_package) record_messages.reset() qitoolchain_action("info") assert record_messages.find("foo") assert record_messages.find("world") assert record_messages.find("bar") record_messages.reset() qitoolchain_action("info", "foo") assert record_messages.find("foo") assert record_messages.find("world") assert not record_messages.find("bar")
def test_simple(qitoolchain_action, toolchains, record_messages): """ Test Simple """ toolchains.create("foo") toolchains.add_package("foo", "boost", package_version="1.57-r3") qitoolchain_action("package-info", "--toolchain", "foo", "boost") assert record_messages.find("boost 1.57-r3")
def test_list(qitoolchain_action, record_messages): """ Test List """ qitoolchain_action("create", "foo") qitoolchain_action("list") assert record_messages.find(r"\* foo")
def test_no_toolchain(qitoolchain_action, record_messages): """ Test No Toolchain """ qitoolchain_action("list") assert record_messages.find("No toolchain yet")