11import numpy as np
22import pytest
33
4- import pandas .util ._test_decorators as td
5-
64import pandas as pd
75from pandas import (
86 Index ,
@@ -249,12 +247,8 @@ def test_min_max(self, left_right_dtypes, index_or_series_or_array):
249247# Arrow interaction
250248
251249
252- pyarrow_skip = td .skip_if_no ("pyarrow" )
253-
254-
255- @pyarrow_skip
256250def test_arrow_extension_type ():
257- import pyarrow as pa
251+ pa = pytest . importorskip ( "pyarrow" )
258252
259253 from pandas .core .arrays .arrow .extension_types import ArrowIntervalType
260254
@@ -269,9 +263,8 @@ def test_arrow_extension_type():
269263 assert hash (p1 ) != hash (p3 )
270264
271265
272- @pyarrow_skip
273266def test_arrow_array ():
274- import pyarrow as pa
267+ pa = pytest . importorskip ( "pyarrow" )
275268
276269 from pandas .core .arrays .arrow .extension_types import ArrowIntervalType
277270
@@ -299,9 +292,8 @@ def test_arrow_array():
299292 pa .array (intervals , type = ArrowIntervalType (pa .float64 (), "left" ))
300293
301294
302- @pyarrow_skip
303295def test_arrow_array_missing ():
304- import pyarrow as pa
296+ pa = pytest . importorskip ( "pyarrow" )
305297
306298 from pandas .core .arrays .arrow .extension_types import ArrowIntervalType
307299
@@ -329,14 +321,13 @@ def test_arrow_array_missing():
329321 assert result .storage .equals (expected )
330322
331323
332- @pyarrow_skip
333324@pytest .mark .parametrize (
334325 "breaks" ,
335326 [[0.0 , 1.0 , 2.0 , 3.0 ], date_range ("2017" , periods = 4 , freq = "D" )],
336327 ids = ["float" , "datetime64[ns]" ],
337328)
338329def test_arrow_table_roundtrip (breaks ):
339- import pyarrow as pa
330+ pa = pytest . importorskip ( "pyarrow" )
340331
341332 from pandas .core .arrays .arrow .extension_types import ArrowIntervalType
342333
@@ -363,14 +354,13 @@ def test_arrow_table_roundtrip(breaks):
363354 tm .assert_frame_equal (result , expected [0 :0 ])
364355
365356
366- @pyarrow_skip
367357@pytest .mark .parametrize (
368358 "breaks" ,
369359 [[0.0 , 1.0 , 2.0 , 3.0 ], date_range ("2017" , periods = 4 , freq = "D" )],
370360 ids = ["float" , "datetime64[ns]" ],
371361)
372362def test_arrow_table_roundtrip_without_metadata (breaks ):
373- import pyarrow as pa
363+ pa = pytest . importorskip ( "pyarrow" )
374364
375365 arr = IntervalArray .from_breaks (breaks )
376366 arr [1 ] = None
@@ -386,12 +376,11 @@ def test_arrow_table_roundtrip_without_metadata(breaks):
386376 tm .assert_frame_equal (result , df )
387377
388378
389- @pyarrow_skip
390379def test_from_arrow_from_raw_struct_array ():
391380 # in case pyarrow lost the Interval extension type (eg on parquet roundtrip
392381 # with datetime64[ns] subtype, see GH-45881), still allow conversion
393382 # from arrow to IntervalArray
394- import pyarrow as pa
383+ pa = pytest . importorskip ( "pyarrow" )
395384
396385 arr = pa .array ([{"left" : 0 , "right" : 1 }, {"left" : 1 , "right" : 2 }])
397386 dtype = pd .IntervalDtype (np .dtype ("int64" ), closed = "neither" )
0 commit comments