From 0806a80eabd0a64d45ef98497ddf4b3b5b1e03b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 28 Jun 2023 15:47:39 +0200 Subject: [PATCH 1/2] GH-35728: [CI][Python] Move test_total_bytes_allocated to a subprocess to improve reliability --- python/pyarrow/tests/test_array.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 65f69a9c0fe..e34408f047f 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -24,6 +24,7 @@ import pickle import pytest import struct +import subprocess import sys import weakref @@ -38,7 +39,17 @@ def test_total_bytes_allocated(): + code = f"""if 1: + import pyarrow as pa + assert pa.total_allocated_bytes() == 0 + """ + res = subprocess.run([sys.executable, "-c", code], + universal_newlines=True, stderr=subprocess.PIPE) + if res.returncode != 0: + print(res.stderr, file=sys.stderr) + res.check_returncode() # fail + assert len(res.stderr.splitlines()) == 0 def test_weakref(): From 4d3d57e455b6de4b953a0e8697de407c58d514fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 28 Jun 2023 16:41:59 +0200 Subject: [PATCH 2/2] Fix linter by removing unnecessary f-string --- python/pyarrow/tests/test_array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index e34408f047f..c33f0be9073 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -39,7 +39,7 @@ def test_total_bytes_allocated(): - code = f"""if 1: + code = """if 1: import pyarrow as pa assert pa.total_allocated_bytes() == 0