Skip to content

Commit a1ae1c2

Browse files
committed
test: enable pytest strict mode
pytest 9 adds native `[tool.pytest]` TOML config and a single `strict` switch that turns on strict_markers, strict_config, strict_xfail and strict_parametrization_ids. Enable it in every package so unregistered marks, unknown config keys, unexpectedly passing xfails and duplicate parametrize ids fail instead of warning. Fixes needed to pass: - test_indexed_dataframe.py: `"region"` appears twice in index_types (once as a columns key, once as a label id), producing ids region0 and region1. Cases now carry explicit, descriptive ids. - test_catalog_user_service.py: drop two `pytest.mark.dependency` marks. pytest-dependency is not installed and nothing uses `depends=`, so they only produced PytestUnknownMarkWarning.
1 parent 26ec554 commit a1ae1c2

10 files changed

Lines changed: 34 additions & 13 deletions

File tree

‎packages/gooddata-dbt/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ source = [
5959
[build-system]
6060
requires = ["hatchling"]
6161
build-backend = "hatchling.build"
62+
63+
[tool.pytest]
64+
strict = true

‎packages/gooddata-eval/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ allowed-unresolved-imports = ["openai.**", "gooddata_api_client.**"]
7171
[build-system]
7272
requires = ["hatchling"]
7373
build-backend = "hatchling.build"
74+
75+
[tool.pytest]
76+
strict = true

‎packages/gooddata-fdw/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@ source = [
7777
[build-system]
7878
requires = ["hatchling"]
7979
build-backend = "hatchling.build"
80+
81+
[tool.pytest]
82+
strict = true

‎packages/gooddata-flexconnect/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,6 @@ source = [
7979
[build-system]
8080
requires = ["hatchling"]
8181
build-backend = "hatchling.build"
82+
83+
[tool.pytest]
84+
strict = true

‎packages/gooddata-flight-server/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ source = [
8686
[build-system]
8787
requires = ["hatchling"]
8888
build-backend = "hatchling.build"
89+
90+
[tool.pytest]
91+
strict = true

‎packages/gooddata-pandas/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,6 @@ source = [
8888
[build-system]
8989
requires = ["hatchling"]
9090
build-backend = "hatchling.build"
91+
92+
[tool.pytest]
93+
strict = true

‎packages/gooddata-pandas/tests/dataframe/test_indexed_dataframe.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414

1515
index_types = [
1616
# reference to the columns key
17-
"region",
18-
dict(reg="region"),
17+
pytest.param("region", id="column_key"),
18+
pytest.param(dict(reg="region"), id="column_key_dict"),
1919
# label_id, i.e. obj id without "label/" prefix - index can reference only attributes
20-
"region",
21-
dict(region="region"),
20+
pytest.param("region", id="label_id"),
21+
pytest.param(dict(region="region"), id="label_id_dict"),
2222
# object identifier in string form
23-
"label/region",
24-
dict(reg="label/region"),
23+
pytest.param("label/region", id="obj_id_str"),
24+
pytest.param(dict(reg="label/region"), id="obj_id_str_dict"),
2525
# Attribute instance
26-
Attribute(local_id="abcd", label=ObjId(id="region", type="label")),
27-
dict(region=Attribute(local_id="abcd", label=ObjId(id="region", type="label"))),
26+
pytest.param(Attribute(local_id="abcd", label=ObjId(id="region", type="label")), id="attribute"),
27+
pytest.param(dict(region=Attribute(local_id="abcd", label=ObjId(id="region", type="label"))), id="attribute_dict"),
2828
# ObjId instance
29-
ObjId(id="region", type="label"),
30-
dict(region=ObjId(id="region", type="label")),
29+
pytest.param(ObjId(id="region", type="label"), id="obj_id"),
30+
pytest.param(dict(region=ObjId(id="region", type="label")), id="obj_id_dict"),
3131
]
3232

3333

‎packages/gooddata-pipelines/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ source = [
4444
[build-system]
4545
requires = ["hatchling"]
4646
build-backend = "hatchling.build"
47+
48+
[tool.pytest]
49+
strict = true

‎packages/gooddata-sdk/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,6 @@ source = [
9393
[build-system]
9494
requires = ["hatchling"]
9595
build-backend = "hatchling.build"
96+
97+
[tool.pytest]
98+
strict = true

‎packages/gooddata-sdk/tests/catalog/test_catalog_user_service.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import copy
2525
from pathlib import Path
2626

27-
import pytest
2827
from gooddata_sdk import (
2928
CatalogAssigneeIdentifier,
3029
CatalogDeclarativeUser,
@@ -581,7 +580,6 @@ def test_user_replace_user_groups(test_config):
581580
assert user_2.user_groups == user_groups
582581

583582

584-
@pytest.mark.dependency(name="test_get_user_permissions")
585583
@gd_vcr.use_cassette(str(_fixtures_dir / "test_get_user_permissions.yaml"))
586584
def test_get_user_permissions(test_config):
587585
"""Test retrieving user permissions.
@@ -644,7 +642,6 @@ def test_manage_user_permissions(test_config):
644642
safe_delete(sdk.catalog_user.manage_user_permissions, user_id, origin_permissions)
645643

646644

647-
@pytest.mark.dependency(name="test_get_user_group_permissions")
648645
@gd_vcr.use_cassette(str(_fixtures_dir / "test_get_user_group_permissions.yaml"))
649646
def test_get_user_group_permissions(test_config):
650647
"""Test retrieving user group permissions.

0 commit comments

Comments
 (0)