Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/pyarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
20 changes: 20 additions & 0 deletions python/pyarrow/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading