Skip to content

Commit 74cd6b0

Browse files
Add counter-example snapshot
1 parent fca070e commit 74cd6b0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

samples/sample_tap_sqlite/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class SQLiteStream(SQLStream):
3434

3535
connector_class = SQLiteConnector
3636

37+
# Use a smaller state message frequency to check intermediate state.
38+
STATE_MSG_FREQUENCY = 10
39+
3740

3841
class SQLiteTap(SQLTap):
3942
"""The Tap class for SQLite."""

tests/samples/test_tap_sqlite.py

+15
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@
33
import json
44
import typing as t
55

6+
import pytest
67
from click.testing import CliRunner
8+
from freezegun import freeze_time
79

810
from samples.sample_tap_sqlite import SQLiteTap
911
from samples.sample_target_csv.csv_target import SampleTargetCSV
1012
from singer_sdk import SQLStream
1113
from singer_sdk._singerlib import MetadataMapping, StreamMetadata
1214
from singer_sdk.testing import (
1315
get_standard_tap_tests,
16+
tap_sync_test,
1417
tap_to_target_sync_test,
1518
)
1619

1720
if t.TYPE_CHECKING:
1821
from pathlib import Path
1922

23+
from pytest_snapshot.plugin import Snapshot
24+
2025
from singer_sdk.tap_base import SQLTap
2126

2227

@@ -116,3 +121,13 @@ def test_sync_sqlite_to_csv(sqlite_sample_tap: SQLTap, tmp_path: Path):
116121
sqlite_sample_tap,
117122
SampleTargetCSV(config={"target_folder": f"{tmp_path}/"}),
118123
)
124+
125+
126+
@freeze_time("2022-01-01T00:00:00Z")
127+
@pytest.mark.snapshot()
128+
def test_sqlite_snapshot(
129+
sqlite_sample_tap: SQLTap,
130+
snapshot: Snapshot,
131+
):
132+
stdout, stderr = tap_sync_test(sqlite_sample_tap)
133+
snapshot.assert_match(stdout.getvalue(), "stdout.jsonl")

0 commit comments

Comments
 (0)