Skip to content

Commit 814a68d

Browse files
aaronsteersxiaohansong
authored andcommitted
AirbyteLib: Mark and deprioritize slow tests (#35298)
1 parent 43cec5a commit 814a68d

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

airbyte-lib/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ requires = ["poetry-core"]
5656
build-backend = "poetry.core.masonry.api"
5757

5858
[tool.pytest.ini_options]
59-
# addopts = "--mypy" # FIXME: This sometimes blocks test discovery and execution
59+
markers = [
60+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
61+
"requires_creds: marks a test as requiring credentials (skip when secrets unavailable)"
62+
]
6063

6164
[tool.ruff.pylint]
6265
max-args = 8 # Relaxed from default of 5

airbyte-lib/tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ def pytest_collection_modifyitems(items: list[Item]) -> None:
4444
'integration' tests because 'u' comes after 'i' alphabetically.
4545
"""
4646
def test_priority(item: Item) -> int:
47-
if 'lint_tests' in str(item.fspath):
47+
if item.get_closest_marker(name="slow"):
48+
return 9 # slow tests have the lowest priority
49+
elif 'lint_tests' in str(item.fspath):
4850
return 1 # lint tests have high priority
4951
elif 'unit_tests' in str(item.fspath):
5052
return 2 # unit tests have highest priority

airbyte-lib/tests/integration_tests/test_snowflake_cache.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def snowflake_cache(snowflake_config) -> Generator[caches.SnowflakeCache, None,
9898
# Uncomment this line if you want to see performance trace logs.
9999
# You can render perf traces using the viztracer CLI or the VS Code VizTracer Extension.
100100
#@viztracer.trace_and_save(output_dir=".pytest_cache/snowflake_trace/")
101+
@pytest.mark.requires_creds
102+
@pytest.mark.slow
101103
def test_faker_read_to_snowflake(
102104
source_faker_seed_a: ab.Source,
103105
snowflake_cache: ab.SnowflakeCache,
@@ -109,6 +111,8 @@ def test_faker_read_to_snowflake(
109111
assert len(list(result.cache.streams["users"])) == FAKER_SCALE_A
110112

111113

114+
@pytest.mark.requires_creds
115+
@pytest.mark.slow
112116
def test_replace_strategy(
113117
source_faker_seed_a: ab.Source,
114118
snowflake_cache: ab.SnowflakeCache,
@@ -121,6 +125,8 @@ def test_replace_strategy(
121125
assert len(list(result.cache.streams["users"])) == FAKER_SCALE_A
122126

123127

128+
@pytest.mark.requires_creds
129+
@pytest.mark.slow
124130
def test_merge_strategy(
125131
source_faker_seed_a: ab.Source,
126132
source_faker_seed_b: ab.Source,

airbyte-lib/tests/integration_tests/test_source_faker_integration.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def test_faker_pks(
141141
assert read_result.cache._get_primary_keys("purchases") == ["id"]
142142

143143

144+
@pytest.mark.slow
144145
def test_replace_strategy(
145146
source_faker_seed_a: ab.Source,
146147
all_cache_types: ab.DuckDBCache,
@@ -155,6 +156,7 @@ def test_replace_strategy(
155156
assert len(list(result.cache.streams["purchases"])) == FAKER_SCALE_A
156157

157158

159+
@pytest.mark.slow
158160
def test_append_strategy(
159161
source_faker_seed_a: ab.Source,
160162
all_cache_types: ab.DuckDBCache,
@@ -167,6 +169,7 @@ def test_append_strategy(
167169
assert len(list(result.cache.streams["purchases"])) == FAKER_SCALE_A * iteration
168170

169171

172+
@pytest.mark.slow
170173
@pytest.mark.parametrize("strategy", ["merge", "auto"])
171174
def test_merge_strategy(
172175
strategy: str,

airbyte-lib/tests/integration_tests/test_source_test_fixture.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,8 @@ def test_sync_to_postgres(new_pg_cache_config: PostgresCacheConfig, expected_tes
688688
check_dtype=False,
689689
)
690690

691+
@pytest.mark.slow
692+
@pytest.mark.requires_creds
691693
def test_sync_to_snowflake(snowflake_config: SnowflakeCacheConfig, expected_test_stream_data: dict[str, list[dict[str, str | int]]]):
692694
source = ab.get_source("source-test", config={"apiKey": "test"})
693695
source.select_all_streams()

0 commit comments

Comments
 (0)