Skip to content

Commit

Permalink
skip 3.11 optional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Nov 2, 2022
1 parent 0fb3aad commit f6d51d6
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,34 @@
DF = DataFrame({"a": [1, 2, 3], "b": [0.0, 0.0, 0.0]})
CWD = os.path.split(os.path.abspath(__file__))[0]


if sys.version_info >= (3, 11):
# This is only needed temporarily due to no wheels being available for arrow on 3.11
_arrow = pytest.importorskip("arrow")

try:
import pyarrow
NO_PYARROW = False
except ImportError:
NO_PYARROW = True

try:
import pytables
NO_PYTABLES = False
except ImportError:
NO_PYTABLES = True

try:
import lxml
NO_LXML = False
except ImportError:
NO_LXML = True


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
def test_orc():
with ensure_clean() as path:
check(assert_type(DF.to_orc(path), None), type(None))
check(assert_type(read_orc(path), DataFrame), DataFrame)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
def test_orc_path():
with ensure_clean() as path:
Expand All @@ -89,6 +105,7 @@ def test_orc_path():
check(assert_type(read_orc(pathlib_path), DataFrame), DataFrame)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
def test_orc_buffer():
with ensure_clean() as path:
Expand All @@ -101,18 +118,21 @@ def test_orc_buffer():
file_r.close()


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
def test_orc_columns():
with ensure_clean() as path:
check(assert_type(DF.to_orc(path, index=False), None), type(None))
check(assert_type(read_orc(path, columns=["a"]), DataFrame), DataFrame)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
@pytest.mark.skipif(WINDOWS, reason="ORC not available on windows")
def test_orc_bytes():
check(assert_type(DF.to_orc(index=False), bytes), bytes)


@pytest.mark.skipif(NO_LXML, reason="lxml not available on 3.11 yet")
def test_xml():
with ensure_clean() as path:
check(assert_type(DF.to_xml(path), None), type(None))
Expand All @@ -121,6 +141,7 @@ def test_xml():
check(assert_type(read_xml(f), DataFrame), DataFrame)


@pytest.mark.skipif(NO_LXML, reason="lxml not available on 3.11 yet")
def test_xml_str():
with ensure_clean() as path:
check(assert_type(DF.to_xml(), str), str)
Expand Down Expand Up @@ -287,12 +308,14 @@ def test_sas_xport() -> None:
pass


@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
def test_hdf():
with ensure_clean() as path:
check(assert_type(DF.to_hdf(path, "df"), None), type(None))
check(assert_type(read_hdf(path), Union[DataFrame, Series]), DataFrame)


@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
def test_hdfstore():
with ensure_clean() as path:
store = HDFStore(path, model="w")
Expand Down Expand Up @@ -334,6 +357,7 @@ def test_hdfstore():
store.close()


@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
def test_read_hdf_iterator():
with ensure_clean() as path:
check(assert_type(DF.to_hdf(path, "df", format="table"), None), type(None))
Expand All @@ -348,6 +372,7 @@ def test_read_hdf_iterator():
ti.close()


@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
def test_hdf_context_manager():
with ensure_clean() as path:
check(assert_type(DF.to_hdf(path, "df", format="table"), None), type(None))
Expand All @@ -356,6 +381,7 @@ def test_hdf_context_manager():
check(assert_type(store.get("df"), Union[DataFrame, Series]), DataFrame)


@pytest.mark.skipif(NO_PYTABLES, reason="pytables not available on 3.11 yet")
def test_hdf_series():
s = DF["a"]
with ensure_clean() as path:
Expand Down Expand Up @@ -397,13 +423,15 @@ def test_json_chunk():
check(assert_type(DF.to_json(), str), str)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
def test_parquet():
with ensure_clean() as path:
check(assert_type(DF.to_parquet(path), None), type(None))
check(assert_type(read_parquet(path), DataFrame), DataFrame)
check(assert_type(DF.to_parquet(), bytes), bytes)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
def test_parquet_options():
with ensure_clean(".parquet") as path:
check(
Expand All @@ -413,6 +441,7 @@ def test_parquet_options():
check(assert_type(read_parquet(path), DataFrame), DataFrame)


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
def test_feather():
with ensure_clean() as path:
check(assert_type(DF.to_feather(path), None), type(None))
Expand Down Expand Up @@ -800,6 +829,7 @@ def test_read_sql_query_generator():
con.close()


@pytest.mark.skipif(NO_PYARROW, reason="pyarrow not available on 3.11 yet")
def test_read_html():
check(assert_type(DF.to_html(), str), str)
with ensure_clean() as path:
Expand Down

0 comments on commit f6d51d6

Please sign in to comment.