Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Mar 27, 2024
1 parent 753ec4a commit c1a0740
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/run_faker_to_motherduck.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
api_key=MOTHERDUCK_API_KEY,
)

result = source.read(cache=cache)
result = source.read(cache=cache, force_full_refresh=True)

for name, records in result.streams.items():
print(f"Stream {name}: {len(records)} records")
6 changes: 6 additions & 0 deletions examples/run_snowflake_faker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
"""
Usage:
poetry install
poetry run python examples/run_snowflake_faker.py
"""

from __future__ import annotations

import airbyte as ab
Expand Down
10 changes: 7 additions & 3 deletions tests/integration_tests/test_all_cache_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import airbyte as ab
from airbyte._executor import _get_bin_dir
from airbyte.progress import progress
from airbyte.progress import progress, ReadProgress


# Product count is always the same, regardless of faker scale.
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_pokeapi_read(
@pytest.fixture(scope="function")
def progress_mock(
mocker: pytest.MockerFixture,
) -> ab.ReadProgress:
) -> ReadProgress:
"""Fixture to return a mocked version of progress.progress."""
# Mock the progress object.
mocker.spy(progress, 'reset')
Expand All @@ -142,7 +142,7 @@ def progress_mock(
def test_faker_read(
source_faker_seed_a: ab.Source,
new_generic_cache: ab.caches.CacheBase,
progress_mock: ab.ReadProgress,
progress_mock: ReadProgress,
) -> None:
"""Test that the append strategy works as expected."""
result = source_faker_seed_a.read(
Expand All @@ -165,6 +165,10 @@ def test_faker_read(
assert progress_mock.log_stream_finalized.call_count == 1
assert progress_mock.log_success.call_count == 1

status_msg: str = progress_mock._get_status_message()
assert "Read **0** records" not in status_msg
assert f"Read **{configured_count}** records" in status_msg

assert len(list(result.cache.streams["users"])) == FAKER_SCALE_A


Expand Down

0 comments on commit c1a0740

Please sign in to comment.