diff --git a/elx/runner.py b/elx/runner.py index ce1f4a8..01d216c 100644 --- a/elx/runner.py +++ b/elx/runner.py @@ -31,6 +31,10 @@ def __init__( self.target = target self.state_manager = state_manager + # Give the tap and target access to the runner + self.tap.runner = self + self.target.runner = self + @property def state_file_name(self) -> str: return f"{self.tap.executable}-{self.target.executable}.json" diff --git a/pyproject.toml b/pyproject.toml index e95f783..cd7f717 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "elx" -version = "0.1.0a6" +version = "0.1.0a7" description = "A lightweight Python interface for extracting and loading using the Singer.io spec." authors = ["Jules Huisman "] readme = "README.md" diff --git a/tests/test_elx/test_runner.py b/tests/test_elx/test_runner.py index b9664ca..69e62de 100644 --- a/tests/test_elx/test_runner.py +++ b/tests/test_elx/test_runner.py @@ -1,4 +1,4 @@ -from elx import Runner +from elx import Runner, Target, Tap from pathlib import Path @@ -24,3 +24,19 @@ def test_config_interpolation_values(runner: Runner): """ assert runner.interpolation_values["TAP_EXECUTABLE"] == "tap-smoke-test" assert runner.interpolation_values["TARGET_EXECUTABLE"] == "target-jsonl" + + +def test_config_interpolation_target_values(tap: Tap): + """ + Make sure the config gets interpolated correctly on the singer side. + """ + target = Target( + "target-jsonl", + config={ + "tap_name": "{TAP_NAME}", + }, + ) + + runner = Runner(tap, target) + + assert runner.target.config["tap_name"] == "tap_smoke_test"