INNER CODE UNIT · Python

test_initialization_is_noninteractive

owlbarn/owl · docker/test_opam_init.py:16

    def test_initialization_is_noninteractive(self):
        repo_root = Path(__file__).resolve().parents[1]
        dockerfiles = [repo_root / "Dockerfile", *sorted((repo_root / "docker").glob("Dockerfile.*"))]
        for dockerfile in dockerfiles:
            for command in re.findall(r"^RUN (.*\bopam init\b.*)$", dockerfile.read_text(), re.M):
                with self.subTest(dockerfile=str(dockerfile.relative_to(repo_root))):
                    # Keep the real input pipeline and init flags, but skip the
                    # compiler and subsequent environment setup for a fast test.
                    command = command.split("&&", 1)[0].strip()
                    command = re.sub(r"--comp\s+\$OCAML_VER", "--bare", command)
                    with tempfile.TemporaryDirectory(prefix="owl-opam-init-") as tmp:
                        path = Path(tmp)
                        repository = path / "repository"
                        repository.mkdir()
                        (repository / "repo").write_text('opam-version: "2.0"\n')
                        command += " " + shlex.join([
                            "--no-opamrc", f"--root={path / 'opam'}",
                            f"--dot-profile={path / 'profile'}", "local", str(repository),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…