Skip to content

Commit d149a69

Browse files
committed
finish refactor to using pydantic models
1 parent e92f948 commit d149a69

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

airbyte_cdk/test/models/scenario.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AcceptanceTestFileTypes(BaseModel):
4444
skip_test: bool
4545
bypass_reason: str
4646

47-
class AcceptanceTestEmptyStreams(BaseModel):
47+
class AcceptanceTestEmptyStream(BaseModel):
4848
name: str
4949
bypass_reason: str | None = None
5050

@@ -54,7 +54,7 @@ class AcceptanceTestEmptyStreams(BaseModel):
5454
_id: str | None = None # Used to override the default ID generation
5555

5656
configured_catalog_path: Path | None = None
57-
empty_streams: list[AcceptanceTestEmptyStreams] | list[str] | None = None
57+
empty_streams: list[AcceptanceTestEmptyStream] | None = None
5858
timeout_seconds: int | None = None
5959
expect_records: AcceptanceTestExpectRecords | None = None
6060
file_types: AcceptanceTestFileTypes | None = None

airbyte_cdk/test/standard_tests/docker_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def test_docker_image_build_and_read(
346346

347347
if scenario.empty_streams:
348348
# If there are empty streams, we remove them from the list of streams to read.
349-
streams_list = list(set(streams_list) - set(scenario.empty_streams))
349+
streams_list = list(set(streams_list) - set(stream.name for stream in scenario.empty_streams))
350350

351351
configured_catalog: ConfiguredAirbyteCatalog = ConfiguredAirbyteCatalog(
352352
streams=[

airbyte_cdk/test/standard_tests/source_base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ def test_basic_read(
121121
# Failed as expected; we're done.
122122
return
123123
streams = discover_result.catalog.catalog.streams # type: ignore [reportOptionalMemberAccess, union-attr]
124-
if scenario.empty_streams is not None:
125-
# If the scenario has an "empty_streams" key, filter out those streams.
126-
streams = [stream for stream in streams if stream.name not in scenario.empty_streams]
124+
125+
if scenario.empty_streams:
126+
# Don't read from any streams marked as empty in the scenario.
127+
streams = list(set(streams) - set(stream.name for stream in scenario.empty_streams))
128+
127129
configured_catalog = ConfiguredAirbyteCatalog(
128130
streams=[
129131
ConfiguredAirbyteStream(

0 commit comments

Comments
 (0)