From 171166180b13469e550c181eaa11cfe95cbb703a Mon Sep 17 00:00:00 2001 From: Kousuke Saruta Date: Fri, 18 Aug 2023 10:53:30 +0900 Subject: [PATCH] AVRO-3832: [Python] Make Python test work with Docker (#2444) * AVRO-3832: [Python] Make Python test work with Docker. * Use contextlib.closing. --- build.sh | 2 +- lang/py/avro/test/gen_interop_data.py | 4 +++- share/docker/Dockerfile | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 0bd1e1880c4..09b02f8da06 100755 --- a/build.sh +++ b/build.sh @@ -341,7 +341,7 @@ do docker-test) tar -cf- share/docker/Dockerfile $DOCKER_EXTRA_CONTEXT | - docker build -t avro-test -f share/docker/Dockerfile - + DOCKER_BUILDKIT=1 docker build -t avro-test -f share/docker/Dockerfile - docker run --rm -v "${PWD}:/avro${DOCKER_MOUNT_FLAG}" --env "JAVA=${JAVA:-8}" avro-test /avro/share/docker/run-tests.sh ;; diff --git a/lang/py/avro/test/gen_interop_data.py b/lang/py/avro/test/gen_interop_data.py index 1993b012826..1bde7ff8764 100644 --- a/lang/py/avro/test/gen_interop_data.py +++ b/lang/py/avro/test/gen_interop_data.py @@ -23,6 +23,7 @@ import io import json import os +from contextlib import closing from pathlib import Path from typing import IO, TextIO @@ -93,7 +94,8 @@ def _parse_args() -> argparse.Namespace: def main() -> int: args = _parse_args() - generate(args.schema_path, args.output_path) + with closing(args.output_path) as op: + generate(args.schema_path, op) return 0 diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile index 2a1cf2b46c2..51e91eab8dd 100644 --- a/share/docker/Dockerfile +++ b/share/docker/Dockerfile @@ -67,7 +67,9 @@ RUN apt-get -qqy update \ python3-wheel \ python3.10 \ python3.11 \ + python3.11-dev \ python3.7 \ + python3.7-distutils \ python3.8 \ python3.9 \ source-highlight \