diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py index f2a874f56fa..c024cdc69a7 100644 --- a/python/pyarrow/__init__.py +++ b/python/pyarrow/__init__.py @@ -156,7 +156,10 @@ def print_entry(label, value): print(f" {fs: <20}: {status: <8}") print("\nCompression Codecs:") - codecs = ["brotli", "bz2", "gzip", "lz4_frame", "lz4", "snappy", "zstd"] + # "lz4" is an alias for "lz4_frame", so the list used to name the same + # codec twice and leave out lz4_raw. See _ensure_compression(). + codecs = ["brotli", "bz2", "gzip", "lz4_frame", "lz4_raw", "snappy", + "zstd"] for codec in codecs: status = "Enabled" if Codec.is_available(codec) else "-" print(f" {codec: <20}: {status: <8}") diff --git a/python/pyarrow/tests/test_misc.py b/python/pyarrow/tests/test_misc.py index 856873f441b..c0fa484e35e 100644 --- a/python/pyarrow/tests/test_misc.py +++ b/python/pyarrow/tests/test_misc.py @@ -123,6 +123,26 @@ def test_runtime_info(): subprocess.check_call([sys.executable, "-c", code], env=env) +def test_show_info(capsys): + pa.show_info() + out = capsys.readouterr().out + + # Which codecs and modules are enabled depends on how PyArrow was built, + # so only the labels are checked, not their status. + assert "Compression Codecs:" in out + codecs = [line.split(":")[0].strip() + for line in out.split("Compression Codecs:")[1].splitlines() + if ":" in line] + # "lz4" is an alias for "lz4_frame", so naming both listed one codec + # twice and left out lz4_raw. + assert codecs == ["brotli", "bz2", "gzip", "lz4_frame", "lz4_raw", + "snappy", "zstd"] + + for section in ("Platform:", "Memory:", "Optional modules:", + "Filesystems:"): + assert section in out + + @pytest.mark.processes def test_import_at_shutdown(): # GH-38626: importing PyArrow at interpreter shutdown would crash