Skip to content

Commit

Permalink
Fix master build (airbytehq#7873)
Browse files Browse the repository at this point in the history
* Check in format diff

* Remove cache http yaml files

* Ignore tmp files generated by unit tests
  • Loading branch information
tuliren authored Nov 11, 2021
1 parent e4120e7 commit c511abd
Show file tree
Hide file tree
Showing 6 changed files with 4,908 additions and 4,445 deletions.
3 changes: 3 additions & 0 deletions airbyte-cdk/python/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.coverage

# TODO: these are tmp files generated by unit tests. They should go to the /tmp directory.
cache_http_stream*.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def token_has_expired(self) -> bool:
return pendulum.now() > self._token_expiry_date

def get_refresh_request_body(self) -> Mapping[str, Any]:
""" Override to define additional parameters """
"""Override to define additional parameters"""
payload: MutableMapping[str, Any] = {
"grant_type": "refresh_token",
"client_id": self.client_id,
Expand Down
10 changes: 5 additions & 5 deletions airbyte-cdk/python/unit_tests/sources/test_abstract_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ def logger() -> AirbyteLogger:


def test_successful_check():
""" Tests that if a source returns TRUE for the connection check the appropriate connectionStatus success message is returned """
"""Tests that if a source returns TRUE for the connection check the appropriate connectionStatus success message is returned"""
expected = AirbyteConnectionStatus(status=Status.SUCCEEDED)
assert expected == MockSource(check_lambda=lambda: (True, None)).check(logger, {})


def test_failed_check():
""" Tests that if a source returns FALSE for the connection check the appropriate connectionStatus failure message is returned """
"""Tests that if a source returns FALSE for the connection check the appropriate connectionStatus failure message is returned"""
expected = AirbyteConnectionStatus(status=Status.FAILED, message="'womp womp'")
assert expected == MockSource(check_lambda=lambda: (False, "womp womp")).check(logger, {})


def test_raising_check():
""" Tests that if a source raises an unexpected exception the connection check the appropriate connectionStatus failure message is returned """
"""Tests that if a source raises an unexpected exception the connection check the appropriate connectionStatus failure message is returned"""
expected = AirbyteConnectionStatus(status=Status.FAILED, message="Exception('this should fail')")
assert expected == MockSource(check_lambda=lambda: exec('raise Exception("this should fail")')).check(logger, {})

Expand Down Expand Up @@ -90,7 +90,7 @@ def primary_key(self) -> Optional[Union[str, List[str], List[List[str]]]]:


def test_discover(mocker):
""" Tests that the appropriate AirbyteCatalog is returned from the discover method """
"""Tests that the appropriate AirbyteCatalog is returned from the discover method"""
airbyte_stream1 = AirbyteStream(
name="1",
json_schema={},
Expand All @@ -113,7 +113,7 @@ def test_discover(mocker):


def test_read_nonexistent_stream_raises_exception(mocker, logger):
"""Tests that attempting to sync a stream which the source does not return from the `streams` method raises an exception """
"""Tests that attempting to sync a stream which the source does not return from the `streams` method raises an exception"""
s1 = MockStream(name="s1")
s2 = MockStream(name="this_stream_doesnt_exist_in_the_source")

Expand Down
Loading

0 comments on commit c511abd

Please sign in to comment.