Skip to content

Commit b98de51

Browse files
authored
infra: upgrade pytest and use pytest_lazy_fixtures (#2978)
<!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change Closes #2810, #393 Relates to #2743 This PR upgrades `pytest` to `9.0.2`. In doing so, we also had to switch `pytest-lazy-fixture` to `pytest-lazy-fixtures` (notice the extra s) which is a maintained version https://github.com/dev-petrov/pytest-lazy-fixtures Changed all references of `pytest_lazyfixture` to the new `pytest_lazy_fixtures` ## Are these changes tested? ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. -->
1 parent bb1f3ef commit b98de51

14 files changed

+176
-167
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ entra-auth = ["azure-identity>=1.25.1"]
100100

101101
[dependency-groups]
102102
dev = [
103-
"pytest==7.4.4",
103+
"pytest==9.0.2",
104104
"pytest-checkdocs==2.14.0",
105105
"prek>=0.2.1,<0.4",
106-
"pytest-lazy-fixture==0.6.3",
106+
"pytest-lazy-fixtures==1.4.0",
107107
"fastavro==1.12.1",
108108
"coverage[toml]>=7.4.2,<8",
109109
"requests-mock==1.12.1",

tests/catalog/test_catalog_behaviors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import pyarrow as pa
2727
import pytest
2828
from pydantic_core import ValidationError
29-
from pytest_lazyfixture import lazy_fixture
29+
from pytest_lazy_fixtures import lf
3030
from sqlalchemy.exc import IntegrityError
3131

3232
from pyiceberg.catalog import Catalog
@@ -323,10 +323,10 @@ def test_write_pyarrow_schema(catalog: Catalog, test_table_identifier: Identifie
323323
@pytest.mark.parametrize(
324324
"schema,expected",
325325
[
326-
(lazy_fixture("pyarrow_schema_simple_without_ids"), lazy_fixture("iceberg_schema_simple_no_ids")),
327-
(lazy_fixture("table_schema_simple"), lazy_fixture("table_schema_simple")),
328-
(lazy_fixture("table_schema_nested"), lazy_fixture("table_schema_nested")),
329-
(lazy_fixture("pyarrow_schema_nested_without_ids"), lazy_fixture("iceberg_schema_nested_no_ids")),
326+
(lf("pyarrow_schema_simple_without_ids"), lf("iceberg_schema_simple_no_ids")),
327+
(lf("table_schema_simple"), lf("table_schema_simple")),
328+
(lf("table_schema_nested"), lf("table_schema_nested")),
329+
(lf("pyarrow_schema_nested_without_ids"), lf("iceberg_schema_nested_no_ids")),
330330
],
331331
)
332332
def test_convert_schema_if_needed(

tests/conftest.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import pytest
4646
from moto import mock_aws
4747
from pydantic_core import to_json
48-
from pytest_lazyfixture import lazy_fixture
48+
from pytest_lazy_fixtures import lf
4949

5050
from pyiceberg.catalog import Catalog, load_catalog
5151
from pyiceberg.catalog.memory import InMemoryCatalog
@@ -3080,23 +3080,21 @@ def fixed_test_table_namespace() -> Identifier:
30803080

30813081

30823082
@pytest.fixture(
3083-
scope="session",
30843083
params=[
3085-
lazy_fixture("fixed_test_table_identifier"),
3086-
lazy_fixture("random_table_identifier"),
3087-
lazy_fixture("random_hierarchical_identifier"),
3084+
lf("fixed_test_table_identifier"),
3085+
lf("random_table_identifier"),
3086+
lf("random_hierarchical_identifier"),
30883087
],
30893088
)
30903089
def test_table_identifier(request: pytest.FixtureRequest) -> Identifier:
30913090
return request.param
30923091

30933092

30943093
@pytest.fixture(
3095-
scope="session",
30963094
params=[
3097-
lazy_fixture("another_fixed_test_table_identifier"),
3098-
lazy_fixture("another_random_table_identifier"),
3099-
lazy_fixture("another_random_hierarchical_identifier"),
3095+
lf("another_fixed_test_table_identifier"),
3096+
lf("another_random_table_identifier"),
3097+
lf("another_random_hierarchical_identifier"),
31003098
],
31013099
)
31023100
def another_table_identifier(request: pytest.FixtureRequest) -> Identifier:
@@ -3105,9 +3103,9 @@ def another_table_identifier(request: pytest.FixtureRequest) -> Identifier:
31053103

31063104
@pytest.fixture(
31073105
params=[
3108-
lazy_fixture("database_name"),
3109-
lazy_fixture("hierarchical_namespace_name"),
3110-
lazy_fixture("fixed_test_table_namespace"),
3106+
lf("database_name"),
3107+
lf("hierarchical_namespace_name"),
3108+
lf("fixed_test_table_namespace"),
31113109
],
31123110
)
31133111
def test_namespace(request: pytest.FixtureRequest) -> Identifier:

tests/integration/test_catalog.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pathlib import Path, PosixPath
2222

2323
import pytest
24+
from pytest_lazy_fixtures import lf
2425

2526
from pyiceberg.catalog import Catalog, MetastoreCatalog, load_catalog
2627
from pyiceberg.catalog.hive import HiveCatalog
@@ -109,12 +110,12 @@ def hive_catalog() -> Generator[Catalog, None, None]:
109110

110111

111112
CATALOGS = [
112-
pytest.lazy_fixture("memory_catalog"),
113-
pytest.lazy_fixture("sqlite_catalog_memory"),
114-
pytest.lazy_fixture("sqlite_catalog_file"),
115-
pytest.lazy_fixture("rest_catalog"),
116-
pytest.lazy_fixture("hive_catalog"),
117-
pytest.lazy_fixture("rest_test_catalog"),
113+
lf("memory_catalog"),
114+
lf("sqlite_catalog_memory"),
115+
lf("sqlite_catalog_file"),
116+
lf("rest_catalog"),
117+
lf("hive_catalog"),
118+
lf("rest_test_catalog"),
118119
]
119120

120121

tests/integration/test_inspect_table.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import pytest
2525
import pytz
2626
from pyspark.sql import DataFrame, SparkSession
27+
from pytest_lazy_fixtures import lf
2728

2829
from pyiceberg.catalog import Catalog
2930
from pyiceberg.exceptions import NoSuchTableError
@@ -672,7 +673,7 @@ def test_inspect_partitions_partitioned_with_filter(spark: SparkSession, session
672673

673674

674675
@pytest.mark.integration
675-
@pytest.mark.parametrize("catalog", [pytest.lazy_fixture("session_catalog")])
676+
@pytest.mark.parametrize("catalog", [lf("session_catalog")])
676677
def test_inspect_partitions_partitioned_transform_with_filter(spark: SparkSession, catalog: Catalog) -> None:
677678
for table_name, predicate, partition_predicate in [
678679
("test_partitioned_by_identity", "ts >= '2023-03-05T00:00:00+00:00'", "ts >= '2023-03-05T00:00:00+00:00'"),

0 commit comments

Comments
 (0)