From 9d138ba626f4489958c04f9eaeb35a2299e4341b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 13 May 2022 11:55:27 +0200 Subject: [PATCH 1/2] ARROW-16548: [Python] Add pytest.mark.parquet to all tests under tests/parquet package --- python/pyarrow/tests/parquet/common.py | 4 ---- python/pyarrow/tests/parquet/conftest.py | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python/pyarrow/tests/parquet/common.py b/python/pyarrow/tests/parquet/common.py index b11e412e63d..cbff41c7b10 100644 --- a/python/pyarrow/tests/parquet/common.py +++ b/python/pyarrow/tests/parquet/common.py @@ -43,10 +43,6 @@ pytest.param(False, marks=pytest.mark.dataset)] ) -# Marks all of the tests in this module -# Ignore these with pytest ... -m 'not parquet' -pytestmark = pytest.mark.parquet - def _write_table(table, path, **kwargs): # So we see the ImportError somewhere diff --git a/python/pyarrow/tests/parquet/conftest.py b/python/pyarrow/tests/parquet/conftest.py index 1e75493cdae..338fe7110b2 100644 --- a/python/pyarrow/tests/parquet/conftest.py +++ b/python/pyarrow/tests/parquet/conftest.py @@ -25,6 +25,14 @@ def datadir(base_datadir): return base_datadir / 'parquet' +def pytest_collection_modifyitems(items): + for item in items: + # Marks all tests in the parquet package + # Ignore these with pytest ... -m 'not parquet'c + if item.parent.parent.name == "parquet": + item.add_marker(pytest.mark.parquet) + + @pytest.fixture def s3_bucket(s3_server): boto3 = pytest.importorskip('boto3') From a2276f4b3300f65e3d28ad6707ab02492c97f6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 13 May 2022 14:53:48 +0200 Subject: [PATCH 2/2] Remove manual test marking via pytest_collection_modifyitems and add the pytest mark on each parquet python file --- python/pyarrow/tests/parquet/conftest.py | 8 -------- python/pyarrow/tests/parquet/test_basic.py | 5 +++++ .../pyarrow/tests/parquet/test_compliant_nested_type.py | 5 +++++ python/pyarrow/tests/parquet/test_data_types.py | 5 +++++ python/pyarrow/tests/parquet/test_dataset.py | 5 +++++ python/pyarrow/tests/parquet/test_datetime.py | 5 +++++ python/pyarrow/tests/parquet/test_encryption.py | 2 ++ python/pyarrow/tests/parquet/test_metadata.py | 5 +++++ python/pyarrow/tests/parquet/test_pandas.py | 5 +++++ python/pyarrow/tests/parquet/test_parquet_file.py | 5 +++++ python/pyarrow/tests/parquet/test_parquet_writer.py | 5 +++++ 11 files changed, 47 insertions(+), 8 deletions(-) diff --git a/python/pyarrow/tests/parquet/conftest.py b/python/pyarrow/tests/parquet/conftest.py index 338fe7110b2..1e75493cdae 100644 --- a/python/pyarrow/tests/parquet/conftest.py +++ b/python/pyarrow/tests/parquet/conftest.py @@ -25,14 +25,6 @@ def datadir(base_datadir): return base_datadir / 'parquet' -def pytest_collection_modifyitems(items): - for item in items: - # Marks all tests in the parquet package - # Ignore these with pytest ... -m 'not parquet'c - if item.parent.parent.name == "parquet": - item.add_marker(pytest.mark.parquet) - - @pytest.fixture def s3_bucket(s3_server): boto3 = pytest.importorskip('boto3') diff --git a/python/pyarrow/tests/parquet/test_basic.py b/python/pyarrow/tests/parquet/test_basic.py index 6712b7fc459..9d31bdeb603 100644 --- a/python/pyarrow/tests/parquet/test_basic.py +++ b/python/pyarrow/tests/parquet/test_basic.py @@ -46,6 +46,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + def test_parquet_invalid_version(tempdir): table = pa.table({'a': [1, 2, 3]}) with pytest.raises(ValueError, match="Unsupported Parquet format version"): diff --git a/python/pyarrow/tests/parquet/test_compliant_nested_type.py b/python/pyarrow/tests/parquet/test_compliant_nested_type.py index 31c62a288db..b60b0273b21 100644 --- a/python/pyarrow/tests/parquet/test_compliant_nested_type.py +++ b/python/pyarrow/tests/parquet/test_compliant_nested_type.py @@ -36,6 +36,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + # Tests for ARROW-11497 _test_data_simple = [ {'items': [1, 2]}, diff --git a/python/pyarrow/tests/parquet/test_data_types.py b/python/pyarrow/tests/parquet/test_data_types.py index 7148af944f9..13d94b6a256 100644 --- a/python/pyarrow/tests/parquet/test_data_types.py +++ b/python/pyarrow/tests/parquet/test_data_types.py @@ -44,6 +44,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + # General roundtrip of data types # ----------------------------------------------------------------------------- diff --git a/python/pyarrow/tests/parquet/test_dataset.py b/python/pyarrow/tests/parquet/test_dataset.py index 2c660a3f6e3..99d2f6d1def 100644 --- a/python/pyarrow/tests/parquet/test_dataset.py +++ b/python/pyarrow/tests/parquet/test_dataset.py @@ -47,6 +47,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas def test_parquet_piece_read(tempdir): df = _test_dataframe(1000) diff --git a/python/pyarrow/tests/parquet/test_datetime.py b/python/pyarrow/tests/parquet/test_datetime.py index 18f78d28892..e10d4fd776d 100644 --- a/python/pyarrow/tests/parquet/test_datetime.py +++ b/python/pyarrow/tests/parquet/test_datetime.py @@ -41,6 +41,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas @parametrize_legacy_dataset def test_pandas_parquet_datetime_tz(use_legacy_dataset): diff --git a/python/pyarrow/tests/parquet/test_encryption.py b/python/pyarrow/tests/parquet/test_encryption.py index fe28b1e0f42..f5e9e76d443 100644 --- a/python/pyarrow/tests/parquet/test_encryption.py +++ b/python/pyarrow/tests/parquet/test_encryption.py @@ -38,7 +38,9 @@ # Marks all of the tests in this module # Ignore these with pytest ... -m 'not parquet_encryption' +# Ignore these with pytest ... -m 'not parquet' pytestmark = pytest.mark.parquet_encryption +pytestmark = pytest.mark.parquet @pytest.fixture(scope='module') diff --git a/python/pyarrow/tests/parquet/test_metadata.py b/python/pyarrow/tests/parquet/test_metadata.py index 35d37e47ca4..bad49847968 100644 --- a/python/pyarrow/tests/parquet/test_metadata.py +++ b/python/pyarrow/tests/parquet/test_metadata.py @@ -41,6 +41,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas def test_parquet_metadata_api(): df = alltypes_sample(size=10000) diff --git a/python/pyarrow/tests/parquet/test_pandas.py b/python/pyarrow/tests/parquet/test_pandas.py index 68253ae0b2b..2c37ac486e2 100644 --- a/python/pyarrow/tests/parquet/test_pandas.py +++ b/python/pyarrow/tests/parquet/test_pandas.py @@ -46,6 +46,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas def test_pandas_parquet_custom_metadata(tempdir): df = alltypes_sample(size=10000) diff --git a/python/pyarrow/tests/parquet/test_parquet_file.py b/python/pyarrow/tests/parquet/test_parquet_file.py index 621cfa6d749..9b528b1859a 100644 --- a/python/pyarrow/tests/parquet/test_parquet_file.py +++ b/python/pyarrow/tests/parquet/test_parquet_file.py @@ -37,6 +37,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas def test_pass_separate_metadata(): # ARROW-471 diff --git a/python/pyarrow/tests/parquet/test_parquet_writer.py b/python/pyarrow/tests/parquet/test_parquet_writer.py index 43fa1f94dbe..6ee3f3b606b 100644 --- a/python/pyarrow/tests/parquet/test_parquet_writer.py +++ b/python/pyarrow/tests/parquet/test_parquet_writer.py @@ -37,6 +37,11 @@ pd = tm = None +# Marks all of the tests in this module +# Ignore these with pytest ... -m 'not parquet' +pytestmark = pytest.mark.parquet + + @pytest.mark.pandas @parametrize_legacy_dataset def test_parquet_incremental_file_build(tempdir, use_legacy_dataset):