Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runner access to tap and target objects. #18

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions elx/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
readme = "README.md"
Expand Down
18 changes: 17 additions & 1 deletion tests/test_elx/test_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from elx import Runner
from elx import Runner, Target, Tap
from pathlib import Path


Expand All @@ -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"
Loading