From 4a9612ca926ff707e4963f2a7a2393b37a84d703 Mon Sep 17 00:00:00 2001 From: JulesHuisman Date: Thu, 2 Nov 2023 09:15:31 +0100 Subject: [PATCH 1/2] Add runner access to tap and target objects. --- elx/runner.py | 4 ++++ tests/test_elx/test_runner.py | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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/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" From 767ba389bd7922959c1254e0f5ffa98bb92cbe91 Mon Sep 17 00:00:00 2001 From: JulesHuisman Date: Thu, 2 Nov 2023 09:15:59 +0100 Subject: [PATCH 2/2] Bump version to 0.1.0a7 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"