Skip to content

Commit

Permalink
Fix testing mishaps
Browse files Browse the repository at this point in the history
  • Loading branch information
pekasen committed Jan 21, 2025
1 parent af25c5d commit d6492d2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion dabapush/Writer/ndjson_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def persist(self):
"""Persist the buffer to the file and flush."""

last_rows = self.buffer
self.buffer = []

_file: Path = Path(self.config.path) / self.config.make_file_name(
additional_keys={"type": "ndjson"}
Expand Down
2 changes: 1 addition & 1 deletion dabapush/Writer/stdout_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, config: "STDOUTWriterConfiguration"):
def persist(self):
last_rows = self.buffer
for row in last_rows:
print(row)
print(row.payload)


class STDOUTWriterConfiguration(WriterConfiguration):
Expand Down
2 changes: 1 addition & 1 deletion tests/Writer/test_Writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_id(writer: Writer):

def test_writer_write_method(writer: Writer):
"""Should write to the buffer."""
queue = (Record(i, i) for i in range(10))
queue = (Record(i, uuid=str(i)) for i in range(10))
writer.write(queue)
assert [_.payload for _ in writer.buffer] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Expand Down
3 changes: 2 additions & 1 deletion tests/Writer/test_stdout_writer.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Test the STDOUTWriter class."""

from dabapush import STDOUTWriterConfiguration
from dabapush.Record import Record


def test_stdout_writer(capsys):
"""Should write to stdout."""
writer = STDOUTWriterConfiguration("stdout1").get_instance()
writer.buffer = ["test"]
writer.buffer = [Record(uuid="test.01", source=None, payload="test")]
writer.persist()

captured = capsys.readouterr()
Expand Down

0 comments on commit d6492d2

Please sign in to comment.