Skip to content

Commit

Permalink
Test with config path
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 2, 2024
1 parent 6aee7da commit 2d6b36f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/core/test_plugin_base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from __future__ import annotations

import typing as t

import pytest

from singer_sdk.plugin_base import SDK_PACKAGE_NAME, MapperNotInitialized, PluginBase
from singer_sdk.typing import IntegerType, PropertiesList, Property, StringType

if t.TYPE_CHECKING:
from pathlib import Path


class PluginTest(PluginBase):
"""Example Plugin for tests."""
Expand All @@ -16,6 +21,18 @@ class PluginTest(PluginBase):
).to_dict()


def test_config_path(tmp_path: Path):
"""Test that the config path is correctly set."""
config_json = '{"prop1": "hello", "prop2": 123}'
config_path = tmp_path / "config.json"
config_path.write_text(config_json)

with pytest.deprecated_call():
plugin = PluginTest(config=config_path)

assert plugin.config == {"prop1": "hello", "prop2": 123}


def test_invalid_config_type():
"""Test that invalid config types raise an error."""
with pytest.raises(TypeError, match="Error parsing config of type 'tuple'"):
Expand Down

0 comments on commit 2d6b36f

Please sign in to comment.