Skip to content

Commit

Permalink
Merge pull request #283 from SUSE/pytest_container_fixes
Browse files Browse the repository at this point in the history
Pytest container fixes
  • Loading branch information
dirkmueller authored Aug 8, 2023
2 parents 8894d33 + 1bc022b commit 2862f6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,19 @@ def test_certificates_are_present(
)
multi_stage_build.prepare_build(tmp_path, pytestconfig.rootpath)

with open(tmp_path / "main.go", "wt") as main_go:
with open(tmp_path / "main.go", "wt", encoding="utf-8") as main_go:
main_go.write(FETCH_SUSE_DOT_COM)

cmd = host.run_expect(
# FIXME: ugly duplication of pytest_container internals :-/
# see: https://github.com/dcermak/pytest_container/issues/149
iidfile = tmp_path / "iid"
host.run_expect(
[0],
f"{' '.join(container_runtime.build_command + get_extra_build_args(pytestconfig))} {tmp_path}",
f"{' '.join(container_runtime.build_command + get_extra_build_args(pytestconfig))} "
f"--iidfile={iidfile} {tmp_path}",
)
img_id = container_runtime.get_image_id_from_stdout(cmd.stdout)
with open(iidfile, "r", encoding="utf-8") as id_f:
_, img_id = id_f.read().strip().split(":")

host.run_expect(
[0],
Expand Down
3 changes: 2 additions & 1 deletion tests/test_php.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ def test_cli_entry_point(
"PHP_BINARY"
in host.run_expect(
[0],
f"{container_runtime.runner_binary} run --rm {container_image.container_id} -r 'print_r(get_defined_constants());'",
f"{container_runtime.runner_binary} run --rm "
f"{container_image.url or container_image.container_id} -r 'print_r(get_defined_constants());'",
).stdout
)

Expand Down

0 comments on commit 2862f6c

Please sign in to comment.