Skip to content

Commit 8918bfe

Browse files
committed
fix tests
1 parent 460c40a commit 8918bfe

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""A sample implementation of custom components that does nothing but will cause syncs to fail if missing."""
2+
3+
from collections.abc import Iterable, MutableMapping
4+
from typing import Any
5+
6+
import requests
7+
8+
from airbyte_cdk.sources.declarative.extractors import DpathExtractor
9+
10+
11+
class IntentionalException(Exception):
12+
"""This exception is raised intentionally in order to test error handling."""
13+
14+
15+
class MyCustomExtractor(DpathExtractor):
16+
"""Dummy class, intentionally raises an exception when extract_records is called."""
17+
18+
def extract_records(
19+
self,
20+
response: requests.Response,
21+
) -> Iterable[MutableMapping[Any, Any]]:
22+
"""Raise an exception when called."""
23+
raise IntentionalException("This is an intentional failure for testing purposes.")

unit_tests/source_declarative_manifest/test_source_declarative_w_custom_components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def sample_method(self) -> str:
4545

4646

4747
def get_fixture_path(file_name) -> str:
48-
return os.path.join(os.path.dirname(__file__), file_name)
48+
return Path(__file__).parent.parent / file_name
4949

5050

5151
def test_components_module_from_string() -> None:

0 commit comments

Comments
 (0)