Skip to content
Merged
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
28 changes: 28 additions & 0 deletions tests/core/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -1415,3 +1415,31 @@ def test_job_magic_methods():

# test __hash__
assert hash(job1) != hash(job2) != hash(job3)


@pytest.mark.xfail(
reason="Mutating one job's config mutates all others created by that decorator.",
strict=True,
)
def test_job_decorator_config_shared():
from jobflow import JobConfig, job

config = JobConfig(manager_config={"key": "original"})

@job(config=config)
def add_configured(a, b):
return a + b

job1 = add_configured(1, 3)
job2 = add_configured(2, 3)

assert job1.config.manager_config == {"key": "original"}
assert job2.config.manager_config == {"key": "original"}

job1.config.manager_config["key"] = "changed"

# job2 should still have the original value.
assert job2.config.manager_config == {"key": "original"}, (
f"Expected job2.config.manager_config to be {{'key': 'original'}}, "
f"but got {job2.config.manager_config!r} — shared instance bug confirmed."
)
Loading