11# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE
22
3- import os
43import pickle
5- import sys
64
75import pytest
86import skhep_testdata
97
108import uproot
119
12- pytest .importorskip ("awkward" )
1310
14-
15- def test_pickle_roundtrip_mmap ():
16- with uproot .open (skhep_testdata .data_path ("uproot-small-dy-withoffsets.root" )) as f :
11+ @pytest .mark .parametrize (
12+ "handler" ,
13+ [
14+ uproot .source .file .MemmapSource ,
15+ # uproot.source.fsspec.FSSpecSource,
16+ ],
17+ )
18+ def test_pickle_roundtrip_local (handler ):
19+ with uproot .open (
20+ skhep_testdata .data_path ("uproot-small-dy-withoffsets.root" ), handler = handler
21+ ) as f :
1722 pkl = pickle .dumps (f ["tree" ])
1823
1924 branch = pickle .loads (pkl )["Muon_pt" ]
@@ -32,9 +37,20 @@ def test_pickle_roundtrip_mmap():
3237 ]
3338
3439
40+ @pytest .mark .parametrize (
41+ "handler" ,
42+ [
43+ uproot .source .http .HTTPSource ,
44+ # uproot.source.fsspec.FSSpecSource,
45+ ],
46+ )
3547@pytest .mark .network
36- def test_pickle_roundtrip_http ():
37- with uproot .open ("https://scikit-hep.org/uproot3/examples/Zmumu.root" ) as f :
48+ def test_pickle_roundtrip_http (handler ):
49+ pytest .importorskip ("aiohttp" )
50+
51+ with uproot .open (
52+ "https://scikit-hep.org/uproot3/examples/Zmumu.root" , handler = handler
53+ ) as f :
3854 pkl = pickle .dumps (f ["events" ])
3955
4056 tree = pickle .loads (pkl )
@@ -53,12 +69,20 @@ def test_pickle_roundtrip_http():
5369 ]
5470
5571
72+ @pytest .mark .parametrize (
73+ "handler" ,
74+ [
75+ uproot .source .xrootd .XRootDSource ,
76+ # uproot.source.fsspec.FSSpecSource,
77+ ],
78+ )
5679@pytest .mark .network
5780@pytest .mark .xrootd
58- def test_pickle_roundtrip_xrootd ():
81+ def test_pickle_roundtrip_xrootd (handler ):
5982 pytest .importorskip ("XRootD" )
6083 with uproot .open (
61- "root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleMuParked.root"
84+ "root://eospublic.cern.ch//eos/root-eos/cms_opendata_2012_nanoaod/Run2012B_DoubleMuParked.root" ,
85+ handler = handler ,
6286 ) as f :
6387 pkl = pickle .dumps (f ["Events" ])
6488
0 commit comments