Skip to content

Commit

Permalink
Add counter-example snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Sep 11, 2023
1 parent fca070e commit 74cd6b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/sample_tap_sqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class SQLiteStream(SQLStream):

connector_class = SQLiteConnector

# Use a smaller state message frequency to check intermediate state.
STATE_MSG_FREQUENCY = 10


class SQLiteTap(SQLTap):
"""The Tap class for SQLite."""
Expand Down
15 changes: 15 additions & 0 deletions tests/samples/test_tap_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@
import json
import typing as t

import pytest
from click.testing import CliRunner
from freezegun import freeze_time

from samples.sample_tap_sqlite import SQLiteTap
from samples.sample_target_csv.csv_target import SampleTargetCSV
from singer_sdk import SQLStream
from singer_sdk._singerlib import MetadataMapping, StreamMetadata
from singer_sdk.testing import (
get_standard_tap_tests,
tap_sync_test,
tap_to_target_sync_test,
)

if t.TYPE_CHECKING:
from pathlib import Path

from pytest_snapshot.plugin import Snapshot

from singer_sdk.tap_base import SQLTap


Expand Down Expand Up @@ -116,3 +121,13 @@ def test_sync_sqlite_to_csv(sqlite_sample_tap: SQLTap, tmp_path: Path):
sqlite_sample_tap,
SampleTargetCSV(config={"target_folder": f"{tmp_path}/"}),
)


@freeze_time("2022-01-01T00:00:00Z")
@pytest.mark.snapshot()
def test_sqlite_snapshot(
sqlite_sample_tap: SQLTap,
snapshot: Snapshot,
):
stdout, stderr = tap_sync_test(sqlite_sample_tap)
snapshot.assert_match(stdout.getvalue(), "stdout.jsonl")

0 comments on commit 74cd6b0

Please sign in to comment.