Exemplo n.º 1
0
def test_query_with_cache(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    assert api.query()

    query = cmake_build / ".cmake" / "api" / "v1" / "query"
    assert query.exists()

    reply = cmake_build / ".cmake" / "api" / "v1" / "reply"
    assert reply.exists()
Exemplo n.º 2
0
def test_read_cmake_files(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    api.parse_doc()
    assert api.query()
    api.read_reply()

    import platform

    system = platform.system()
    if system == "Linux":
        assert "GNU" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    elif system == "Windows":
        assert "MSVC" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    elif system == "Darwin":
        assert "Clang" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    else:
        raise RuntimeError("Unexpected system")
Exemplo n.º 3
0
def test_read_variable(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    assert api.query()
    assert api.read_reply()

    assert api.get_variable_doc("testproject_BINARY_DIR")
Exemplo n.º 4
0
def test_query_without_cache(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    (cmake_build / "CMakeCache.txt").unlink()

    assert not api.query()