Skip to content

Commit d08a989

Browse files
maxgallipre-commit-ci[bot]ianna
authored
fix: test to check that we can write via xrootd (#1380)
* 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]>
1 parent b64d85b commit d08a989

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ test = [
7070
"deflate",
7171
"minio",
7272
"aiohttp",
73-
"fsspec-xrootd",
73+
"fsspec-xrootd>=0.5.0",
7474
"s3fs",
7575
"paramiko",
7676
"pytest>=6",
@@ -86,7 +86,7 @@ test-pyodide = [
8686
"pytest-timeout",
8787
"scikit-hep-testdata"
8888
]
89-
xrootd = ["fsspec-xrootd"]
89+
xrootd = ["fsspec-xrootd>=0.5.0"]
9090

9191
[project.urls]
9292
Download = "https://github.com/scikit-hep/uproot5/releases"

tests/test_0692_fsspec_writing.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pathlib
1010
import fsspec
1111
import numpy as np
12+
import awkward as ak
1213

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

@@ -218,3 +219,22 @@ def test_fsspec_writing_memory(tmp_path, scheme):
218219

219220
with uproot.open(uri) as f:
220221
assert f["tree"]["x"].array().tolist() == [1, 2, 3]
222+
223+
224+
def test_write_append_fsspec_xrootd(xrootd_server):
225+
remote_path, _ = xrootd_server
226+
filename = "file.root"
227+
remote_file_path = os.path.join(remote_path, filename)
228+
array = ak.Array({"x": [1, 2, 3], "y": [4, 5, 6]})
229+
file = uproot.recreate(remote_file_path)
230+
file["tree"] = array
231+
file.close()
232+
array2 = ak.Array({"x": [1, 2, 3, 4], "y": [4, 5, 6, 7]})
233+
file = uproot.update(remote_file_path)
234+
file["other_tree"] = array2
235+
file.close()
236+
with uproot.open(remote_file_path) as f:
237+
assert f["tree"]["x"].array().tolist() == [1, 2, 3]
238+
assert f["tree"]["y"].array().tolist() == [4, 5, 6]
239+
assert f["other_tree"]["x"].array().tolist() == [1, 2, 3, 4]
240+
assert f["other_tree"]["y"].array().tolist() == [4, 5, 6, 7]

0 commit comments

Comments
 (0)