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

airbyte-lib: Allow to skip slower tests #34901

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion airbyte-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ airbyte-lib is a library that allows to run Airbyte syncs embedded into any Pyth
- Make sure [Poetry is installed](https://python-poetry.org/docs/#).
- Run `poetry install`
- For examples, check out the `examples` folder. They can be run via `poetry run python examples/<example file>`
- Unit tests and type checks can be run via `poetry run pytest`
- Unit tests and type checks can be run via `poetry run pytest`. Snowflake and postgres integration tests run a little longer, to do a quick local validation you can skip them by running `poetry run pytest -m "not slow"`

## Release

Expand Down
5 changes: 4 additions & 1 deletion airbyte-lib/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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\"')",
]


[tool.ruff.pylint]
max-args = 8 # Relaxed from default of 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,19 @@ def postgres_cache(new_pg_cache_config) -> Generator[caches.PostgresCache, None,

@pytest.fixture
def all_cache_types(
request,
duckdb_cache: ab.DuckDBCache,
snowflake_cache: ab.SnowflakeCache,
postgres_cache: ab.PostgresCache,
):
_ = postgres_cache
return [
duckdb_cache,
postgres_cache,
# snowflake_cache, # Snowflake works, but is slow and expensive to test. # TODO: Re-enable.
]
if 'not slow' in request.config.getoption("-m"):
# Return only duckdb_cache if 'slow' tests are excluded
return [duckdb_cache]
else:
# Return all caches otherwise
return [
duckdb_cache,
request.getfixturevalue("postgres_cache"),
# request.getfixturevalue("snowflake_cache"), # Snowflake works, but is very slow and expensive to test. # TODO: Re-enable.
]


def test_faker_pks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ def test_sync_to_postgres(new_pg_cache_config: PostgresCacheConfig, expected_tes
check_dtype=False,
)

@pytest.mark.slow
def test_sync_to_snowflake(snowflake_config: SnowflakeCacheConfig, expected_test_stream_data: dict[str, list[dict[str, str | int]]]):
source = ab.get_connector("source-test", config={"apiKey": "test"})
cache = SnowflakeSQLCache(config=snowflake_config)
Expand Down
Loading