Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 30, 2024
1 parent 14d6d40 commit cbc4486
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 3 additions & 2 deletions singer_sdk/contrib/filesystem/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ def discover_streams(self) -> list:
tap=self,
name=self.config["stream_name"],
filepaths=[
os.path.join(path, member["name"]) # noqa: PTH118
member["name"]
for member in self.fs.listdir(path)
if member["name"].endswith(self.valid_extensions)
if member["type"] == "file"
and member["name"].endswith(self.valid_extensions)
],
filesystem=self.fs,
)
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/testing/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def run(
ValueError: if Test instance does not have `name` and `type` properties.
"""
if not self.name or not self.plugin_type:
msg = "Test must have 'name' and 'type' properties."
msg = "Test must have 'name' and 'plugin_type' properties."

Check warning on line 107 in singer_sdk/testing/templates.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/testing/templates.py#L107

Added line #L107 was not covered by tests
raise ValueError(msg)

self.config = config
Expand Down
22 changes: 14 additions & 8 deletions tests/samples/test_tap_csv.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from __future__ import annotations

import datetime
import typing as t

import pytest

from samples.sample_tap_csv.sample_tap_csv import SampleTapCSV
from singer_sdk.testing import SuiteConfig, get_tap_test_class
from singer_sdk.testing import SuiteConfig, TapTestRunner, get_tap_test_class

if t.TYPE_CHECKING:
from samples.sample_tap_csv.client import CSVStream

_TestCSVMerge = get_tap_test_class(
tap_class=SampleTapCSV,
Expand Down Expand Up @@ -76,10 +80,12 @@ class TestCSVOneStreamPerFile(_TestCSVOneStreamPerFile):


class TestCSVOneStreamPerFileIncremental(_TestCSVOneStreamPerFileIncremental):
@pytest.mark.xfail(reason="No records are extracted", strict=True)
def test_tap_stream_transformed_catalog_schema_matches_record(self, stream: str):
super().test_tap_stream_transformed_catalog_schema_matches_record(stream)

@pytest.mark.xfail(reason="No records are extracted", strict=True)
def test_tap_stream_returns_record(self, stream: str):
super().test_tap_stream_returns_record(stream)
def test_tap_stream_returns_record(
self,
config: SuiteConfig,
resource: t.Any,
runner: TapTestRunner,
stream: CSVStream,
):
with pytest.warns(UserWarning):
super().test_tap_stream_returns_record(config, resource, runner, stream)

0 comments on commit cbc4486

Please sign in to comment.