You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2024/02/20 11:21:32 UTC
(arrow) 20/30: GH-39849: [Python] Remove the use of pytest-lazy-fixture (#39850)
This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch maint-15.0.x
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit aa172aa00776f20dc05d8d400d60f0d5ba3d076e
Author: Alenka Frim <Al...@users.noreply.github.com>
AuthorDate: Thu Feb 1 14:35:32 2024 +0100
GH-39849: [Python] Remove the use of pytest-lazy-fixture (#39850)
### Rationale for this change
Removing the use of `pytest-lazy-fixture` in our test suite as it is unmaintained.
Changes in this PR include:
- Remove the use of `pytest-lazy-fixture`
- Remove marks from fixtures to avoid future error, see
```
PytestRemovedIn9Warning: Marks applied to fixtures have no effect
See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
```
- Catch two different warnings in `def test_legacy_int_type()`
### Are these changes tested?
The changes affect the tests so they must pass.
### Are there any user-facing changes?
No.
* Closes: #39849
Lead-authored-by: AlenkaF <fr...@gmail.com>
Co-authored-by: Joris Van den Bossche <jo...@gmail.com>
Signed-off-by: Joris Van den Bossche <jo...@gmail.com>
---
ci/conda_env_python.txt | 3 +--
dev/tasks/conda-recipes/arrow-cpp/meta.yaml | 1 -
python/pyarrow/tests/conftest.py | 7 +++---
python/pyarrow/tests/test_dataset.py | 3 ---
python/pyarrow/tests/test_extension_type.py | 5 +----
python/pyarrow/tests/test_fs.py | 34 ++++++++++++++---------------
python/pyarrow/tests/test_ipc.py | 6 ++---
python/requirements-test.txt | 1 -
python/requirements-wheel-test.txt | 1 -
9 files changed, 25 insertions(+), 36 deletions(-)
diff --git a/ci/conda_env_python.txt b/ci/conda_env_python.txt
index 5fdd21d2bd..59e2def1bf 100644
--- a/ci/conda_env_python.txt
+++ b/ci/conda_env_python.txt
@@ -23,9 +23,8 @@ cloudpickle
fsspec
hypothesis
numpy>=1.16.6
-pytest<8 # pytest-lazy-fixture broken on pytest 8.0.0
+pytest<8
pytest-faulthandler
-pytest-lazy-fixture
s3fs>=2023.10.0
setuptools
setuptools_scm<8.0.0
diff --git a/dev/tasks/conda-recipes/arrow-cpp/meta.yaml b/dev/tasks/conda-recipes/arrow-cpp/meta.yaml
index b8ffbfdb71..367445c595 100644
--- a/dev/tasks/conda-recipes/arrow-cpp/meta.yaml
+++ b/dev/tasks/conda-recipes/arrow-cpp/meta.yaml
@@ -340,7 +340,6 @@ outputs:
# test_cpp_extension_in_python requires a compiler
- {{ compiler("cxx") }} # [linux]
- pytest
- - pytest-lazy-fixture
- backports.zoneinfo # [py<39]
- boto3
- cffi
diff --git a/python/pyarrow/tests/conftest.py b/python/pyarrow/tests/conftest.py
index a5941e8c8d..0da757a4bc 100644
--- a/python/pyarrow/tests/conftest.py
+++ b/python/pyarrow/tests/conftest.py
@@ -24,7 +24,6 @@ import time
import urllib.request
import pytest
-from pytest_lazyfixture import lazy_fixture
import hypothesis as h
from ..conftest import groups, defaults
@@ -259,13 +258,13 @@ def gcs_server():
@pytest.fixture(
params=[
- lazy_fixture('builtin_pickle'),
- lazy_fixture('cloudpickle')
+ 'builtin_pickle',
+ 'cloudpickle'
],
scope='session'
)
def pickle_module(request):
- return request.param
+ return request.getfixturevalue(request.param)
@pytest.fixture(scope='session')
diff --git a/python/pyarrow/tests/test_dataset.py b/python/pyarrow/tests/test_dataset.py
index ae2146c0bd..04732fefbd 100644
--- a/python/pyarrow/tests/test_dataset.py
+++ b/python/pyarrow/tests/test_dataset.py
@@ -100,7 +100,6 @@ def assert_dataset_fragment_convenience_methods(dataset):
@pytest.fixture
-@pytest.mark.parquet
def mockfs():
mockfs = fs._MockFileSystem()
@@ -219,7 +218,6 @@ def multisourcefs(request):
@pytest.fixture
-@pytest.mark.parquet
def dataset(mockfs):
format = ds.ParquetFileFormat()
selector = fs.FileSelector('subdir', recursive=True)
@@ -2679,7 +2677,6 @@ def test_dataset_partitioned_dictionary_type_reconstruct(tempdir, pickle_module)
@pytest.fixture
-@pytest.mark.parquet
def s3_example_simple(s3_server):
from pyarrow.fs import FileSystem
diff --git a/python/pyarrow/tests/test_extension_type.py b/python/pyarrow/tests/test_extension_type.py
index a88e20eefe..d8c792ef00 100644
--- a/python/pyarrow/tests/test_extension_type.py
+++ b/python/pyarrow/tests/test_extension_type.py
@@ -1485,10 +1485,7 @@ def test_legacy_int_type():
batch = pa.RecordBatch.from_arrays([ext_arr], names=['ext'])
buf = ipc_write_batch(batch)
- with pytest.warns(
- RuntimeWarning,
- match="pickle-based deserialization of pyarrow.PyExtensionType "
- "subclasses is disabled by default"):
+ with pytest.warns((RuntimeWarning, FutureWarning)):
batch = ipc_read_batch(buf)
assert isinstance(batch.column(0).type, pa.UnknownExtensionType)
diff --git a/python/pyarrow/tests/test_fs.py b/python/pyarrow/tests/test_fs.py
index d0fa253e31..ab10addfc3 100644
--- a/python/pyarrow/tests/test_fs.py
+++ b/python/pyarrow/tests/test_fs.py
@@ -362,79 +362,79 @@ def py_fsspec_s3fs(request, s3_server):
@pytest.fixture(params=[
pytest.param(
- pytest.lazy_fixture('localfs'),
+ 'localfs',
id='LocalFileSystem()'
),
pytest.param(
- pytest.lazy_fixture('localfs_with_mmap'),
+ 'localfs_with_mmap',
id='LocalFileSystem(use_mmap=True)'
),
pytest.param(
- pytest.lazy_fixture('subtree_localfs'),
+ 'subtree_localfs',
id='SubTreeFileSystem(LocalFileSystem())'
),
pytest.param(
- pytest.lazy_fixture('s3fs'),
+ 's3fs',
id='S3FileSystem',
marks=pytest.mark.s3
),
pytest.param(
- pytest.lazy_fixture('gcsfs'),
+ 'gcsfs',
id='GcsFileSystem',
marks=pytest.mark.gcs
),
pytest.param(
- pytest.lazy_fixture('hdfs'),
+ 'hdfs',
id='HadoopFileSystem',
marks=pytest.mark.hdfs
),
pytest.param(
- pytest.lazy_fixture('mockfs'),
+ 'mockfs',
id='_MockFileSystem()'
),
pytest.param(
- pytest.lazy_fixture('py_localfs'),
+ 'py_localfs',
id='PyFileSystem(ProxyHandler(LocalFileSystem()))'
),
pytest.param(
- pytest.lazy_fixture('py_mockfs'),
+ 'py_mockfs',
id='PyFileSystem(ProxyHandler(_MockFileSystem()))'
),
pytest.param(
- pytest.lazy_fixture('py_fsspec_localfs'),
+ 'py_fsspec_localfs',
id='PyFileSystem(FSSpecHandler(fsspec.LocalFileSystem()))'
),
pytest.param(
- pytest.lazy_fixture('py_fsspec_memoryfs'),
+ 'py_fsspec_memoryfs',
id='PyFileSystem(FSSpecHandler(fsspec.filesystem("memory")))'
),
pytest.param(
- pytest.lazy_fixture('py_fsspec_s3fs'),
+ 'py_fsspec_s3fs',
id='PyFileSystem(FSSpecHandler(s3fs.S3FileSystem()))',
marks=pytest.mark.s3
),
])
def filesystem_config(request):
- return request.param
+ return request.getfixturevalue(request.param)
@pytest.fixture
-def fs(request, filesystem_config):
+def fs(filesystem_config):
return filesystem_config['fs']
@pytest.fixture
-def pathfn(request, filesystem_config):
+def pathfn(filesystem_config):
return filesystem_config['pathfn']
@pytest.fixture
-def allow_move_dir(request, filesystem_config):
+def allow_move_dir(filesystem_config):
return filesystem_config['allow_move_dir']
@pytest.fixture
-def allow_append_to_file(request, filesystem_config):
+def allow_append_to_file(filesystem_config):
return filesystem_config['allow_append_to_file']
diff --git a/python/pyarrow/tests/test_ipc.py b/python/pyarrow/tests/test_ipc.py
index f75ec8158a..407011d90b 100644
--- a/python/pyarrow/tests/test_ipc.py
+++ b/python/pyarrow/tests/test_ipc.py
@@ -142,16 +142,16 @@ def stream_fixture():
@pytest.fixture(params=[
pytest.param(
- pytest.lazy_fixture('file_fixture'),
+ 'file_fixture',
id='File Format'
),
pytest.param(
- pytest.lazy_fixture('stream_fixture'),
+ 'stream_fixture',
id='Stream Format'
)
])
def format_fixture(request):
- return request.param
+ return request.getfixturevalue(request.param)
def test_empty_file():
diff --git a/python/requirements-test.txt b/python/requirements-test.txt
index b3ba5d852b..2108d70a54 100644
--- a/python/requirements-test.txt
+++ b/python/requirements-test.txt
@@ -2,5 +2,4 @@ cffi
hypothesis
pandas
pytest<8
-pytest-lazy-fixture
pytz
diff --git a/python/requirements-wheel-test.txt b/python/requirements-wheel-test.txt
index c74a8ca690..a1046bc18c 100644
--- a/python/requirements-wheel-test.txt
+++ b/python/requirements-wheel-test.txt
@@ -2,7 +2,6 @@ cffi
cython
hypothesis
pytest<8
-pytest-lazy-fixture
pytz
tzdata; sys_platform == 'win32'