You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Router and worker tests re-type the same setup, and the copies have drifted.
129 of 706 router tests spell out create_experiment → create_seq_score_set → mock_worker_variant_insertion → publish_score_set inline. No helper builds a published score set with variants.
publish_score_set (tests/helpers/util/score_set.py) doesn't patch the job queue, so all 195 call sites wrap it in their own patch.object(ArqRedis, "enqueue_job"). 107 assert assert_called_once() and 88 don't, and the patch target is spelled two ways.
send_slack_job_error is patched 42 times in 11 files, none of them in a conftest.
The same Variant → MappedVariant block appears 22 times in 5 worker test files.
Tests use three worker contexts, none shaped like production's standalone_ctx() (worker/settings/lifecycle.py). mock_worker_ctx (tests/worker/conftest_optional.py, 641 references) has no "state", so the job-log write guarded in worker/lib/decorators/job_management.py is skipped in every test that uses it.
Problem
Router and worker tests re-type the same setup, and the copies have drifted.
create_experiment→create_seq_score_set→mock_worker_variant_insertion→publish_score_setinline. No helper builds a published score set with variants.publish_score_set(tests/helpers/util/score_set.py) doesn't patch the job queue, so all 195 call sites wrap it in their ownpatch.object(ArqRedis, "enqueue_job"). 107 assertassert_called_once()and 88 don't, and the patch target is spelled two ways.send_slack_job_erroris patched 42 times in 11 files, none of them in a conftest.Variant→MappedVariantblock appears 22 times in 5 worker test files.standalone_ctx()(worker/settings/lifecycle.py).mock_worker_ctx(tests/worker/conftest_optional.py, 641 references) has no"state", so the job-log write guarded inworker/lib/decorators/job_management.pyis skipped in every test that uses it.Scope
published_score_set_with_variantsscenario builder intests/builders/scenarios.py, built through the routes per Build DB test objects with factory_boy and side-effecting ones with HTTP scenario builders #782, returning a dataclass handle.publish_score_setpatches the queue itself and returns the mock.send_slack_job_error, replacing per-test patches as tests are touched.pool,redis,hdp,state), replacing the three.MappedVariantfactory replacing the 22 inline blocks.Acceptance criteria
test_collections.pyandtest_experiments.pyuse them in place of inline setup.standalone_ctx()'s keys, and a test asserts the job log is written.MappedVariantinline.