diff --git a/airbyte-lib/pyproject.toml b/airbyte-lib/pyproject.toml index 203c446552eed..d1bdb3049c0cc 100644 --- a/airbyte-lib/pyproject.toml +++ b/airbyte-lib/pyproject.toml @@ -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 diff --git a/airbyte-lib/tests/conftest.py b/airbyte-lib/tests/conftest.py index 64a3b83431b70..0824d77f3eb8e 100644 --- a/airbyte-lib/tests/conftest.py +++ b/airbyte-lib/tests/conftest.py @@ -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 diff --git a/airbyte-lib/tests/integration_tests/test_snowflake_cache.py b/airbyte-lib/tests/integration_tests/test_snowflake_cache.py index be8aacd8decc1..4ac08f4bebe3b 100644 --- a/airbyte-lib/tests/integration_tests/test_snowflake_cache.py +++ b/airbyte-lib/tests/integration_tests/test_snowflake_cache.py @@ -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, @@ -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, @@ -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, diff --git a/airbyte-lib/tests/integration_tests/test_source_faker_integration.py b/airbyte-lib/tests/integration_tests/test_source_faker_integration.py index 22e16b6ef0afc..244c52f0e901e 100644 --- a/airbyte-lib/tests/integration_tests/test_source_faker_integration.py +++ b/airbyte-lib/tests/integration_tests/test_source_faker_integration.py @@ -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, @@ -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, @@ -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, diff --git a/airbyte-lib/tests/integration_tests/test_source_test_fixture.py b/airbyte-lib/tests/integration_tests/test_source_test_fixture.py index 6fc9d04bc0470..dadc7b12da72c 100644 --- a/airbyte-lib/tests/integration_tests/test_source_test_fixture.py +++ b/airbyte-lib/tests/integration_tests/test_source_test_fixture.py @@ -688,6 +688,8 @@ def test_sync_to_postgres(new_pg_cache_config: PostgresCacheConfig, expected_tes check_dtype=False, ) +@pytest.mark.slow +@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()