Skip to content

Commit

Permalink
fix: test to check that we can write via xrootd (#1380)
Browse files Browse the repository at this point in the history
* add test to check that we can write via xrootd

* add append test to write via xrootd

* set minimum version of fsspec-xrootd to 0.5.0

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ianna Osborne <[email protected]>
  • Loading branch information
3 people authored Feb 27, 2025
1 parent b64d85b commit d08a989
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test = [
"deflate",
"minio",
"aiohttp",
"fsspec-xrootd",
"fsspec-xrootd>=0.5.0",
"s3fs",
"paramiko",
"pytest>=6",
Expand All @@ -86,7 +86,7 @@ test-pyodide = [
"pytest-timeout",
"scikit-hep-testdata"
]
xrootd = ["fsspec-xrootd"]
xrootd = ["fsspec-xrootd>=0.5.0"]

[project.urls]
Download = "https://github.com/scikit-hep/uproot5/releases"
Expand Down
20 changes: 20 additions & 0 deletions tests/test_0692_fsspec_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pathlib
import fsspec
import numpy as np
import awkward as ak

is_windows = sys.platform.startswith("win")

Expand Down Expand Up @@ -218,3 +219,22 @@ def test_fsspec_writing_memory(tmp_path, scheme):

with uproot.open(uri) as f:
assert f["tree"]["x"].array().tolist() == [1, 2, 3]


def test_write_append_fsspec_xrootd(xrootd_server):
remote_path, _ = xrootd_server
filename = "file.root"
remote_file_path = os.path.join(remote_path, filename)
array = ak.Array({"x": [1, 2, 3], "y": [4, 5, 6]})
file = uproot.recreate(remote_file_path)
file["tree"] = array
file.close()
array2 = ak.Array({"x": [1, 2, 3, 4], "y": [4, 5, 6, 7]})
file = uproot.update(remote_file_path)
file["other_tree"] = array2
file.close()
with uproot.open(remote_file_path) as f:
assert f["tree"]["x"].array().tolist() == [1, 2, 3]
assert f["tree"]["y"].array().tolist() == [4, 5, 6]
assert f["other_tree"]["x"].array().tolist() == [1, 2, 3, 4]
assert f["other_tree"]["y"].array().tolist() == [4, 5, 6, 7]

0 comments on commit d08a989

Please sign in to comment.