Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AirbyteLib: Mark and deprioritize slow tests #35298

Merged
merged 7 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion airbyte-lib/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

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

[tool.ruff.pylint]
max-args = 8 # Relaxed from default of 5
Expand Down
4 changes: 3 additions & 1 deletion airbyte-lib/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def pytest_collection_modifyitems(items: list[Item]) -> None:
'integration' tests because 'u' comes after 'i' alphabetically.
"""
def test_priority(item: Item) -> int:
if 'lint_tests' in str(item.fspath):
if item.get_closest_marker(name="slow"):
return 9 # slow tests have the lowest priority
elif 'lint_tests' in str(item.fspath):
return 1 # lint tests have high priority
elif 'unit_tests' in str(item.fspath):
return 2 # unit tests have highest priority
Expand Down
6 changes: 6 additions & 0 deletions airbyte-lib/tests/integration_tests/test_snowflake_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def snowflake_cache(snowflake_config) -> Generator[caches.SnowflakeCache, None,
# Uncomment this line if you want to see performance trace logs.
# You can render perf traces using the viztracer CLI or the VS Code VizTracer Extension.
#@viztracer.trace_and_save(output_dir=".pytest_cache/snowflake_trace/")
@pytest.mark.requires_creds
@pytest.mark.slow
def test_faker_read_to_snowflake(
source_faker_seed_a: ab.Source,
snowflake_cache: ab.SnowflakeCache,
Expand All @@ -109,6 +111,8 @@ def test_faker_read_to_snowflake(
assert len(list(result.cache.streams["users"])) == FAKER_SCALE_A


@pytest.mark.requires_creds
@pytest.mark.slow
def test_replace_strategy(
source_faker_seed_a: ab.Source,
snowflake_cache: ab.SnowflakeCache,
Expand All @@ -121,6 +125,8 @@ def test_replace_strategy(
assert len(list(result.cache.streams["users"])) == FAKER_SCALE_A


@pytest.mark.requires_creds
@pytest.mark.slow
def test_merge_strategy(
source_faker_seed_a: ab.Source,
source_faker_seed_b: ab.Source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_faker_pks(
assert read_result.cache._get_primary_keys("purchases") == ["id"]


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


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


@pytest.mark.slow
@pytest.mark.parametrize("strategy", ["merge", "auto"])
def test_merge_strategy(
strategy: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ def test_sync_to_postgres(new_pg_cache_config: PostgresCacheConfig, expected_tes
check_dtype=False,
)

@pytest.mark.slow
aaronsteers marked this conversation as resolved.
Show resolved Hide resolved
@pytest.mark.requires_creds
def test_sync_to_snowflake(snowflake_config: SnowflakeCacheConfig, expected_test_stream_data: dict[str, list[dict[str, str | int]]]):
source = ab.get_source("source-test", config={"apiKey": "test"})
source.select_all_streams()
Expand Down
Loading