Skip to content

Commit

Permalink
Resolving int test bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
s7clarke10 committed Aug 28, 2024
1 parent 79dbe67 commit b0959b3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
28 changes: 16 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ include = [
[tool.poetry.dependencies]
python = ">=3.8,<3.13"
realit_singer_python = "^5.0.0"
boto3 = "1.34.158"
boto3 = "1.35.8"
realit-singer-encodings = ">=2.1.0"
voluptuous = "0.14.2"
ujson = ">=5.4.0"
Expand Down
1 change: 0 additions & 1 deletion run_integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def run_command(command, env=None):
container_name = "minio_server"
result = is_container_running(container_name)
print(result)
print(os.environ)
if result or 'GITHUB_ACTIONS' in os.environ:
rc = run_command(['poetry', 'run', 'pytest', 'tests/integration'],env=os.environ)
raise SystemExit(rc)
Expand Down
20 changes: 13 additions & 7 deletions tests/integration/test_tap_s3_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os.path
import random
import unittest
import sys
from copy import deepcopy

import boto3
Expand Down Expand Up @@ -149,15 +150,18 @@ def setUpClass(cls) -> None:

@classmethod
def tearDownClass(cls) -> None:
s3_client = boto3.client("s3")
# Remove test file from bucket
s3_client = boto3.client(
"s3", endpoint_url=cls.config["aws_endpoint_url"]
)
s3_client.delete_object(Bucket=cls.config["bucket"], Key=cls.obj_name)

def test_discovery(self):
f = io.StringIO()
with contextlib.redirect_stdout(f):
file_buffer = io.StringIO()
with contextlib.redirect_stdout(file_buffer):
do_discover(self.config)

catalog = ujson.loads(f.getvalue())
catalog = ujson.loads(file_buffer.getvalue())

self.assertIsInstance(catalog, dict)
self.assertEqual(1, len(catalog["streams"]))
Expand Down Expand Up @@ -188,12 +192,14 @@ def test_sync(self):
# set stream to selected
catalog["streams"][0]["metadata"][0]["metadata"]["selected"] = True

f = io.StringIO()
with contextlib.redirect_stdout(f):
file_buffer = io.TextIOWrapper(io.BytesIO(), sys.stdout.encoding)
with contextlib.redirect_stdout(file_buffer):
do_sync(self.config, catalog, {})

# Position at the start of the buffer
file_buffer.seek(0)
lines = [
ujson.loads(line) for line in f.getvalue().strip().splitlines()
ujson.loads(line) for line in file_buffer.read().strip().splitlines()
]

self.assertDictEqual({"type": "STATE", "value": {}}, lines[0])
Expand Down

0 comments on commit b0959b3

Please sign in to comment.