Skip to content

Commit 0b5d8d6

Browse files
lobispre-commit-ci[bot]jpivarski
authored
test: s3fs pytest unraisable exception (#1012)
* install optional fsspec backends in the CI for some python versions * update submit interface * annotation * do not use named arguments for the path/url * Future init * add s3fs and sshfs as test dependencies (fsspec beckends) * test fsspec s3 for more combination of parameters * remove pip install from ci * style: pre-commit fixes * revert test order * remove dependencies as a test * add s3fs to test * exclude s3fs to python version 3.12 * add sshfs test (skipped) * fix pytest * asyncio not available in 3.12 * asyncio not available in 3.12 * add comment for fsspec threads * attempt to close resources * handle s3fs case separate for now * attempt to pass tests * attempt to pass tests * simplified * remove support for use_threads option, run non-async fs in threads using asyncio * stop the loop on resource shutdown * add skip for xrootd due to server issues * remove skip for xrootd * remove shutdown * understand ci fail * enable test that uses s3fs * skip test for CI * skip tests on problematic python versions * test S3Source only in its test file * fix pytest parameter * rename test * rename test function (duplicate name) * imports * rerun on timeout * rerun on timeout * remove minio * skip s3fs test instead * rename test * no s3 in test names * improve pytest regex * python 3.8 skip * skip s3_fail when timeout * error tuple * line jump --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jim Pivarski <[email protected]>
1 parent 81750f8 commit 0b5d8d6

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

tests/test_0029-more-string-types.py renamed to tests/test_0029_more_string_types.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE
22

3-
import json
4-
import sys
5-
6-
import numpy
73
import pytest
84
import skhep_testdata
95

@@ -82,7 +78,7 @@ def test_parse_typename():
8278
parse_typename("map<string, int>>")
8379

8480

85-
def test_strings1():
81+
def test_strings_1():
8682
with uproot.open(skhep_testdata.data_path("uproot-small-evnt-tree-fullsplit.root"))[
8783
"tree"
8884
] as tree:
@@ -166,23 +162,23 @@ def test_top_level_vectors():
166162
]
167163

168164

169-
def test_strings1():
165+
def test_strings_2():
170166
with uproot.open(skhep_testdata.data_path("uproot-issue31.root"))[
171167
"T/name"
172168
] as branch:
173169
result = branch.array(library="np")
174170
assert result.tolist() == ["one", "two", "three", "four", "five"]
175171

176172

177-
def test_strings2():
173+
def test_strings_3():
178174
with uproot.open(skhep_testdata.data_path("uproot-small-evnt-tree-fullsplit.root"))[
179175
"tree/Str"
180176
] as branch:
181177
result = branch.array(library="np")
182178
assert result.tolist() == [f"evt-{i:03d}" for i in range(100)]
183179

184180

185-
def test_strings3():
181+
def test_strings_4():
186182
with uproot.open(skhep_testdata.data_path("uproot-small-evnt-tree-fullsplit.root"))[
187183
"tree/StdStr"
188184
] as branch:

tests/test_0341-manipulate-streamer-info.py renamed to tests/test_0341_manipulate_streamer_info.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44

5-
import numpy as np
65
import pytest
76

87
import uproot
@@ -80,7 +79,7 @@ def test_with_mkdir(tmp_path):
8079
f6.mkdir("three")
8180

8281

83-
def test_add_streamers1(tmp_path):
82+
def test_add_streamers_1(tmp_path):
8483
has_TObjString = os.path.join(tmp_path, "has_TObjString.root")
8584

8685
f_TObjString = ROOT.TFile(has_TObjString, "recreate")
@@ -120,7 +119,7 @@ def test_add_streamers1(tmp_path):
120119
f4.Close()
121120

122121

123-
def test_add_streamers2(tmp_path):
122+
def test_add_streamers_2(tmp_path):
124123
has_histogram = os.path.join(tmp_path, "has_histogram.root")
125124

126125
f_histogram = ROOT.TFile(has_histogram, "recreate")
@@ -208,7 +207,7 @@ def test_add_streamers2(tmp_path):
208207
f3.Close()
209208

210209

211-
def test_add_streamers3(tmp_path):
210+
def test_add_streamers_3(tmp_path):
212211
has_TObjString = os.path.join(tmp_path, "has_TObjString.root")
213212

214213
f_TObjString = ROOT.TFile(has_TObjString, "recreate")

tests/test_0692_fsspec_reading.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import fsspec
1010
import requests
1111
import os
12+
import sys
1213

1314

1415
def test_open_fsspec_http(server):
@@ -53,13 +54,17 @@ def test_open_fsspec_local():
5354
@pytest.mark.parametrize(
5455
"handler",
5556
[
56-
# uproot.source.fsspec.FSSpecSource,
57+
uproot.source.fsspec.FSSpecSource,
5758
uproot.source.s3.S3Source,
5859
None,
5960
],
6061
)
6162
def test_open_fsspec_s3(handler):
6263
pytest.importorskip("s3fs")
64+
if sys.version_info < (3, 11):
65+
pytest.skip(
66+
"https://github.com/scikit-hep/uproot5/pull/1012",
67+
)
6368

6469
with uproot.open(
6570
"s3://pivarski-princeton/pythia_ppZee_run17emb.picoDst.root:PicoDst",

tests/test_0916_read_from_s3.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE
22

3+
import socket
4+
35
import pytest
46

57
import uproot
68

79
pytest.importorskip("minio")
810

911

10-
@pytest.mark.skip("https://github.com/scikit-hep/uproot5/pull/1012")
1112
@pytest.mark.network
1213
def test_s3_fail():
13-
# TODO: fix this! Something not closing properly.
14-
with pytest.raises(FileNotFoundError):
14+
with pytest.raises((FileNotFoundError, TimeoutError, socket.timeout)):
15+
# Sometimes this raises a timeout error that doesn't go away for a long time, we might as well skip it.
1516
with uproot.source.s3.S3Source(
1617
"s3://pivarski-princeton/does-not-exist", timeout=0.1
1718
) as source:

0 commit comments

Comments
 (0)