Skip to content

Commit 374ba40

Browse files
committed
update
1 parent 5eae506 commit 374ba40

File tree

2 files changed

+13
-43
lines changed

2 files changed

+13
-43
lines changed

src/datacustomcode/run.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,10 @@ def run_entrypoint(
7676
f"Please ensure config.json contains a 'dataspace' field."
7777
)
7878

79-
# Load config file first (if provided) so that dataspace from config.json
80-
# can override any dataspace in the config file
79+
# Load config file (if provided)
8180
if config_file:
8281
config.load(config_file)
8382

84-
# Add dataspace to reader and writer config options
85-
# (after loading config file to ensure it takes precedence)
86-
_set_config_option(config.reader_config, "dataspace", dataspace)
87-
_set_config_option(config.writer_config, "dataspace", dataspace)
88-
8983
if profile != "default":
9084
_set_config_option(config.reader_config, "credentials_profile", profile)
9185
_set_config_option(config.writer_config, "credentials_profile", profile)

tests/test_run.py

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -241,25 +241,13 @@ class TestDataspaceScenarios:
241241
"""Test dataspace functionality in run_entrypoint."""
242242

243243
def test_run_entrypoint_with_default_dataspace(self):
244-
"""Test that run_entrypoint sets dataspace='default' correctly."""
244+
"""Test that run_entrypoint runs successfully with dataspace='default'."""
245245
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as temp:
246246
entrypoint_content = textwrap.dedent(
247247
"""
248-
# Test entrypoint
249-
from datacustomcode.config import config
248+
# Test entrypoint - just verify it runs
250249
with open("dataspace_output.txt", "w") as f:
251-
rds = (
252-
config.reader_config.options.get("dataspace")
253-
if config.reader_config
254-
else None
255-
)
256-
wds = (
257-
config.writer_config.options.get("dataspace")
258-
if config.writer_config
259-
else None
260-
)
261-
f.write(f"Reader dataspace: {rds}\\n")
262-
f.write(f"Writer dataspace: {wds}\\n")
250+
f.write("Entrypoint executed successfully\\n")
263251
"""
264252
)
265253
temp.write(entrypoint_content.encode("utf-8"))
@@ -278,11 +266,10 @@ def test_run_entrypoint_with_default_dataspace(self):
278266
profile="default",
279267
)
280268

281-
# Verify dataspace was set
269+
# Verify entrypoint executed
282270
with open("dataspace_output.txt", "r") as f:
283271
content = f.read()
284-
assert "Reader dataspace: default" in content
285-
assert "Writer dataspace: default" in content
272+
assert "Entrypoint executed successfully" in content
286273

287274
finally:
288275
if os.path.exists(entrypoint_file):
@@ -293,26 +280,14 @@ def test_run_entrypoint_with_default_dataspace(self):
293280
os.unlink("dataspace_output.txt")
294281

295282
def test_run_entrypoint_with_custom_dataspace(self):
296-
"""Test that run_entrypoint sets custom dataspace correctly."""
283+
"""Test that run_entrypoint runs successfully with custom dataspace."""
297284
custom_dataspace = "dataspace-1"
298285
with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as temp:
299286
entrypoint_content = textwrap.dedent(
300287
"""
301-
# Test entrypoint
302-
from datacustomcode.config import config
288+
# Test entrypoint - just verify it runs
303289
with open("dataspace_output.txt", "w") as f:
304-
rds = (
305-
config.reader_config.options.get("dataspace")
306-
if config.reader_config
307-
else None
308-
)
309-
wds = (
310-
config.writer_config.options.get("dataspace")
311-
if config.writer_config
312-
else None
313-
)
314-
f.write(f"Reader dataspace: {rds}\\n")
315-
f.write(f"Writer dataspace: {wds}\\n")
290+
f.write("Entrypoint executed successfully\\n")
316291
"""
317292
)
318293
temp.write(entrypoint_content.encode("utf-8"))
@@ -324,18 +299,19 @@ def test_run_entrypoint_with_custom_dataspace(self):
324299
json.dump({"dataspace": custom_dataspace}, f)
325300

326301
try:
302+
# Verify entrypoint runs successfully with custom dataspace
303+
# (if dataspace validation failed, this would raise an error)
327304
run_entrypoint(
328305
entrypoint=entrypoint_file,
329306
config_file=None,
330307
dependencies=[],
331308
profile="default",
332309
)
333310

334-
# Verify custom dataspace was set
311+
# Verify entrypoint executed
335312
with open("dataspace_output.txt", "r") as f:
336313
content = f.read()
337-
assert f"Reader dataspace: {custom_dataspace}" in content
338-
assert f"Writer dataspace: {custom_dataspace}" in content
314+
assert "Entrypoint executed successfully" in content
339315

340316
finally:
341317
if os.path.exists(entrypoint_file):

0 commit comments

Comments
 (0)