def test_dist()

in utils/build-dists.py [0:0]


def test_dist(dist):
    with set_tmp_dir() as tmp_dir:
        # Build the venv and install the dist
        run("python", "-m", "venv", os.path.join(tmp_dir, "venv"))
        venv_python = os.path.join(tmp_dir, "venv/bin/python")
        run(venv_python, "-m", "pip", "install", "-U", "pip", "mypy")
        run(venv_python, "-m", "pip", "install", dist)

        # Test the namespace and top-level clients
        run(venv_python, "-c", "import elastic_enterprise_search")
        for client in ("EnterpriseSearch", "AppSearch", "WorkplaceSearch"):
            run(venv_python, "-c", f"from elastic_enterprise_search import {client}")

        # Uninstall and ensure that clients aren't available
        run(venv_python, "-m", "pip", "uninstall", "--yes", "elastic-enterprise-search")

        run(venv_python, "-c", "import elastic_enterprise_search", expect_exit_code=256)
        for client in ("EnterpriseSearch", "AppSearch", "WorkplaceSearch"):
            run(
                venv_python,
                "-c",
                f"from elastic_enterprise_search import {client}",
                expect_exit_code=256,
            )