614973e658
Reduce the Python suite from 224 to 115 collected cases. The local Python run took about 43 seconds. Historical runs of the SQLite and PostgreSQL TEA gates alone total roughly two hours. The full baseline was not timed again. WebApp unit sources and e2e/ are unchanged. The Python and WebApp suites run on the test machines. Checks: ruff check, ruff format --check, lint-imports (two contracts kept), and pytest (115 passed, 7 warnings in 42.52s). Remove the hospital and reference fixtures, reference capture tool, HL7 validator, and test-only SQL Server, PostgreSQL and Dask services. Remove the Playwright Python runner and CI step pending P5.5. Keep the synthetic TEA drawing and ConceptMap for that seed, and retain the Synthea modules, site's drawing and ConceptMap, and test image's Java and Synthea runtime for the documented synthetic.load workflow. Production Dask settings and deployment services stay in place. Use one temporary SQLite engine with attached schemas and a per-test dlt directory for persistence tests. Render the three existing gold SQL models with minimal Jinja bindings and seeded upstream rows. That keeps the first valid EEG, score attachment, and latest ADOS-2 checks independent of a dbt build. Seed EEG selection directly in SQLite. Drive API rules by direct calls and use a minimal Dagster client double for cancellation. Let the real preview op run with an in-process context and use a missing EDF to exercise cleanup after failure. Use fixed synthetic values for spectral tests, measures, FHIR rows and survival outcomes. Keep execution map logic in sync mode. Drop the internal batch-size override and assert content addressing, temporary file cleanup and deduplication instead. The retained I/O tests guard behavior that requires actual storage: - test_person_ids_survive_a_review_merge_and_split checks persistent identities and replacement links across successive reviews. - test_collected_files_are_kept_once_by_content and test_save_analyses_writes_eeg_sites verify rows or bytes written to SQLite by the real persistence path. - test_tea_follow_up runs the actual SQL rules and joins in SQLite. - The bundle export tests (determinism, manifest hashes, version selection) need real registry snapshots and archive bytes. Round-trip, duplicate import, tamper and untrusted-digest tests require the archive or registry to verify the outcomes. Lifecycle checks require real alias, report and retirement state in SQLite. - test_import_rejects_invalid_uploads, test_training_inputs and test_previews_area assert real filesystem cleanup or preservation. Both preview-op cleanup tests verify that temporary study input is deleted on return and on error. The bad-reference test verifies filesystem-based cohort diagnostics without measuring a cohort. - The three synthetic TEA checks exercise the generated SQLite hospital's profile coverage and reproducibility, and read the emitted PDFs with the actual drawing's extraction patterns. removed tests/test_dbt_tea_follow_up.py::test_tea_follow_up[sqlite] — slow integration (logic now covered by test_tea_follow_up executing the production model SQL against small SQLite tables) removed tests/test_dbt_tea_follow_up.py::test_tea_follow_up[postgres] — slow integration (logic now covered by the SQLite-only test_tea_follow_up) removed tests/test_persistance_eeg_sites.py::test_save_analyses_writes_eeg_sites — slow integration (logic now covered by the in-process SQLite test_save_analyses_writes_eeg_sites) removed tests/test_persistance_files.py::test_collected_files_wait_on_disk_and_are_kept_in_batches — slow integration (logic now covered by test_collected_files_are_kept_once_by_content) removed tests/test_synthetic_tea.py::test_every_eeg_reads_as_a_study — slow integration (logic now covered by test_header_reads_the_facts) removed tests/test_synthetic_tea.py::test_the_clean_eegs_pass_the_analysis — slow integration (logic now covered by test_dominant_peak_recovers_a_posterior_rhythm_above_background and test_band_power_excludes_line_noise_and_rescales_clean_bins for the underlying signal calculations) removed models/tests/test_bundle.py::test_guard_runs_on_export_and_on_import — implementation-detail removed models/tests/test_cacu_models.py — parity-only removed models/tests/test_cacu_models.py::test_predictions_match_the_current_models — parity-only removed models/tests/test_cacu_models.py::test_survival_matches_the_current_model_with_its_index_fixed — parity-only removed models/tests/test_cacu_models.py::test_a_cohort_the_site_lacks_is_reported_not_trained — implementation-detail removed models/tests/test_cama_models.py — parity-only removed models/tests/test_cama_models.py::test_survival_matches_the_current_model — parity-only removed models/tests/test_edf_node.py — slow integration (logic now covered by test_header_reads_the_facts, test_not_an_edf_is_not_valid and test_collected_files_are_kept_once_by_content) removed models/tests/test_edf_node.py::test_edf_pipeline_keeps_and_links_the_files — slow integration (logic now covered by test_header_reads_the_facts, test_not_an_edf_is_not_valid and test_collected_files_are_kept_once_by_content) removed models/tests/test_edf_upload.py — slow integration (logic now covered by test_tea_eeg_first_n_selects_exactly_n_pending_studies for study selection) removed models/tests/test_edf_upload.py::test_an_uploaded_edf_is_analysed_by_itself — slow integration (logic now covered by test_tea_eeg_first_n_selects_exactly_n_pending_studies for study selection) removed models/tests/test_eeg.py::test_verdicts_and_checks — parity-only removed models/tests/test_eeg.py::test_metric_values — parity-only removed models/tests/test_eeg.py::test_reference_features — parity-only removed models/tests/test_eeg.py::test_curves — parity-only removed models/tests/test_execution.py::test_map_empty_items_starts_nothing — implementation-detail removed models/tests/test_execution.py::test_map_local_equals_sync — slow integration (logic now covered by test_map_sync_keeps_input_order_and_reports_each_item) removed models/tests/test_execution.py::test_map_lazy_items_are_not_all_loaded_at_once — implementation-detail removed models/tests/test_execution.py::test_progress_tag_and_log_lines_inside_running — implementation-detail removed models/tests/test_execution.py::test_no_tag_outside_running — implementation-detail removed models/tests/test_execution.py::test_version_mismatch_fails_before_any_task — implementation-detail removed models/tests/test_execution.py::test_local_cancel_leaves_no_worker_processes — slow integration (logic now covered by test_cancel_returns_the_terminal_or_cancelling_state for cancellation states) removed models/tests/test_execution.py::test_health_sync_and_local — slow integration (logic now covered by test_resolve_defaults_and_allow_list for execution defaults) removed models/tests/test_execution.py::test_health_unreachable_remote — slow integration (logic now covered by test_resolve_rejects_unlisted_scheduler_and_scheduler_in_local_mode for scheduler validation) removed models/tests/test_execution.py::test_health_rejects_unlisted_scheduler — implementation-detail removed models/tests/test_execution.py::test_progress_reaches_the_dagster_run — slow integration (logic now covered by test_shape_progress_tag and test_map_sync_keeps_input_order_and_reports_each_item) removed models/tests/test_execution.py::test_map_remote_equals_sync — slow integration (logic now covered by test_map_sync_keeps_input_order_and_reports_each_item) removed models/tests/test_execution.py::test_health_remote — slow integration (logic now covered by test_resolve_defaults_and_allow_list for remote execution choice) removed models/tests/test_execution.py::test_remote_cancel_cancels_futures — slow integration (logic now covered by test_cancel_returns_the_terminal_or_cancelling_state for cancellation states) removed models/tests/test_execution.py::test_progress_json_is_stable — implementation-detail removed models/tests/test_execution.py::test_map_on_error_converts_a_failed_item[local] — slow integration (logic now covered by test_map_on_error_converts_a_failed_item) removed models/tests/test_execution.py::test_map_raises_without_on_error[local] — slow integration (logic now covered by test_map_raises_without_on_error) removed models/tests/test_ingest.py — slow integration (logic now covered by test_collected_files_are_kept_once_by_content and test_the_drawn_patterns_read_every_report) removed models/tests/test_ingest.py::test_a_site_reaches_bronze_once_and_its_documents_are_read — slow integration (logic now covered by test_collected_files_are_kept_once_by_content and test_the_drawn_patterns_read_every_report) removed models/tests/test_recurrence.py::test_cohorts — parity-only removed models/tests/test_recurrence.py::test_routines — parity-only removed models/tests/test_recurrence.py::test_c_index_and_internal_auc — parity-only removed models/tests/test_recurrence.py::test_saved_model — parity-only removed models/tests/test_recurrence.py::test_calculator — parity-only removed models/tests/test_recurrence.py::test_risk_factors — parity-only removed models/tests/test_recurrence.py::test_train_reproduces_v1 — parity-only removed models/tests/test_silver.py::test_a_site_becomes_silver_and_review_gets_the_rest — slow integration (logic now covered by test_person_ids_survive_a_review_merge_and_split and test_a_code_nobody_mapped_is_held_with_the_reason) removed models/tests/test_survival_seer.py — parity-only removed models/tests/test_survival_seer.py::test_each_scenario_takes_the_originals_patients_and_deaths — parity-only removed models/tests/test_survival_seer.py::test_each_scenarios_observed_curves_are_the_originals — parity-only removed models/tests/test_survival_seer.py::test_the_models_points_are_the_survival_of_the_cases_it_learned_from — parity-only removed models/tests/test_tea_association.py::test_reference_parity — parity-only removed models/tests/test_tea_job.py::test_tea_eeg_runs_the_four_steps_in_order — implementation-detail removed models/tests/test_tea_job.py::test_a_failing_analysis_stops_the_graph — implementation-detail removed models/tests/test_tea_job.py::test_a_bad_scope_fails_before_any_work — implementation-detail removed models/tests/test_tea_job.py::test_config_mirrors_match_the_shared_models — implementation-detail removed models/tests/test_tea_job.py::test_definitions_load_with_every_job_and_the_sensor — implementation-detail removed models/tests/test_tea_job.py::test_relate_returns_none_without_a_champion — implementation-detail removed models/tests/test_tea_job.py::test_tea_eeg_first_n_analyses_exactly_n — slow integration (logic now covered by test_tea_eeg_first_n_selects_exactly_n_pending_studies) removed models/tests/test_tea_job.py::test_tea_eeg_remote_mode_gives_the_same_analysis — slow integration (logic now covered by test_dominant_peak_recovers_a_posterior_rhythm_above_background and test_centile_interpolation_preserves_scoring) removed models/tests/test_tea_preview.py::test_scores_come_from_the_champions — implementation-detail removed models/tests/test_tea_preview.py::test_no_champions_warns_and_leaves_z_empty — implementation-detail removed models/tests/test_tea_preview.py::test_ados2_read_with_the_pipeline_patterns — implementation-detail removed models/tests/test_tea_preview.py::test_ados2_problems_are_warnings_not_errors — implementation-detail removed models/tests/test_tea_preview.py::test_the_job_deletes_its_files_and_returns_the_result_as_output — slow integration (logic now covered by the direct-op test_the_job_deletes_its_files_and_returns_the_result_as_output) removed models/tests/test_tea_preview.py::test_the_job_deletes_its_files_when_the_study_fails — implementation-detail removed models/tests/test_tea_reference.py::test_a_named_reference_resolves_under_the_root — implementation-detail removed models/tests/test_tea_reference.py::test_60_hz_changes_the_digest_and_is_passed_on — implementation-detail removed models/tests/test_tea_reference.py::test_the_cache_is_named_by_cohort_and_digest_and_reused — implementation-detail removed models/tests/test_tea_reference.py::test_legacy_environment_still_works — implementation-detail removed models/tests/test_tea_reference.py::test_train_records_cohort_and_line_hz — implementation-detail removed models/tests/test_tea_reference.py::test_the_train_op_passes_the_reference_or_refuses_it — implementation-detail removed models/tests/test_tea_reference.py::test_reference_config_mirrors_the_shared_model — implementation-detail removed WebApi/tests/test_bundles.py::test_export_and_import_through_the_api — slow integration (logic now covered by test_layout_and_manifest_hold_every_file_hash and test_roundtrip_registers_candidates_with_lineage) removed WebApi/tests/test_bundles.py::test_import_refuses_a_wrong_sha_and_a_non_zip — slow integration (logic now covered by test_import_rejects_invalid_uploads) removed WebApi/tests/test_bundles.py::test_importing_the_same_bundle_again_fails_the_run — slow integration (logic now covered by test_importing_twice_is_a_conflict_and_partial_imports_skip) removed WebApi/tests/test_bundles.py::test_export_guard_failure_is_422 — slow integration (logic now covered by test_reference_group_size and test_selection_champion_latest_all) removed WebApi/tests/test_bundles.py::test_an_untrusted_bundle_is_refused — slow integration (logic now covered by test_import_rejects_invalid_uploads and test_import_refuses_an_untrusted_digest) removed WebApi/tests/test_cacu.py — parity-only removed WebApi/tests/test_cacu.py::test_cacu_from_the_hospital_to_indicators_and_risks — parity-only removed WebApi/tests/test_cama.py — parity-only removed WebApi/tests/test_cama.py::test_cama_from_the_hospital_to_indicators — parity-only removed WebApi/tests/test_conectar.py — slow integration (logic now covered by test_person_ids_survive_a_review_merge_and_split and test_a_concept_map_onto_a_code_no_field_allows_is_refused) removed WebApi/tests/test_conectar.py::test_an_operator_connects_a_site_and_settles_its_review — slow integration (logic now covered by test_person_ids_survive_a_review_merge_and_split and test_a_concept_map_onto_a_code_no_field_allows_is_refused) removed WebApi/tests/test_fhir_door.py — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url and tests/test_core_tea_fhir.py for FHIR mappings) removed WebApi/tests/test_fhir_door.py::test_what_one_platform_serves_another_places_through_the_fhir_door — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url and tests/test_core_tea_fhir.py for FHIR mappings) removed WebApi/tests/test_fhir_door.py::test_a_new_label_is_a_concept_map_row_not_code — slow integration (logic now covered by test_hospital_codes_and_dates_become_platform_values) removed WebApi/tests/test_governance.py::test_version_lifecycle — slow integration (logic now covered by models/tests/test_bundle.py::test_version_lifecycle) removed WebApi/tests/test_governance.py::test_imported_lineage — slow integration (logic now covered by test_roundtrip_registers_candidates_with_lineage) removed WebApi/tests/test_governance.py::test_preview — slow integration (logic now covered by test_the_job_deletes_its_files_and_returns_the_result_as_output and test_shape_outputs) removed WebApi/tests/test_governance.py::test_training_inputs — slow integration (logic now covered by the direct-call test_training_inputs) removed WebApi/tests/test_runs.py::test_unknown_run_is_404 — implementation-detail removed WebApi/tests/test_runs.py::test_failed_run_reports_its_error — slow integration (logic now covered by test_shape_failure_message_is_the_ops_own_exception) removed WebApi/tests/test_runs.py::test_history_filters_by_job_and_domain — implementation-detail removed WebApi/tests/test_runs.py::test_run_requests_validate_the_execution_choice — slow integration (logic now covered by test_resolve_rejects_unlisted_scheduler_and_scheduler_in_local_mode) removed WebApi/tests/test_runs.py::test_execution_options_and_health — implementation-detail removed WebApi/tests/test_runs.py::test_tea_eegs_analyze_validates_scope — slow integration (logic now covered by test_scope_validation) removed WebApi/tests/test_runs.py::test_a_locked_run_storage_is_read_again — implementation-detail removed WebApi/tests/test_runs.py::test_cancel_waits_for_a_starting_run — implementation-detail removed WebApi/tests/test_runs.py::test_cancel_a_finished_run_is_409 — slow integration (logic now covered by test_cancel_a_finished_run_is_409 with a client double) removed WebApi/tests/test_runs_concurrency.py — slow integration (logic now covered by test_cancel_returns_the_terminal_or_cancelling_state for the queued transition) removed WebApi/tests/test_runs_concurrency.py::test_writing_runs_never_overlap — implementation-detail removed WebApi/tests/test_runs_concurrency.py::test_cancelling_an_ingest_run_leaves_no_silver_or_gold — slow integration (logic now covered by test_cancel_returns_the_terminal_or_cancelling_state for the API state transition) removed WebApi/tests/test_runs_concurrency.py::test_cancelling_a_queued_run_never_starts_it — slow integration (logic now covered by test_cancel_returns_the_terminal_or_cancelling_state for the queued transition) removed WebApi/tests/test_runs_concurrency.py::test_a_dead_run_does_not_stay_running — implementation-detail removed WebApi/tests/test_synthea.py — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url and test_hospital_codes_and_dates_become_platform_values) removed WebApi/tests/test_synthea.py::test_a_synthea_population_comes_in_through_the_fhir_door — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url and test_hospital_codes_and_dates_become_platform_values) removed WebApi/tests/test_synthea_cama.py — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url for FHIR ingestion mapping) removed WebApi/tests/test_synthea_cama.py::test_a_synthea_cama_population_comes_in_through_the_fhir_door — slow integration (logic now covered by test_fhir_in_joins_encounter_results_and_subject_by_full_url for FHIR ingestion mapping) removed WebApi/tests/test_tea.py — parity-only removed WebApi/tests/test_tea.py::test_tea_from_the_hospital_to_indicators — parity-only removed WebApi/tests/test_training_config.py::test_tea_training_config_schema — slow integration (logic now covered by the direct-call test_tea_training_config_schema) removed WebApi/tests/test_training_config.py::test_other_domains_have_no_reference — slow integration (logic now covered by the direct-call test_other_domains_have_no_reference) removed WebApi/tests/test_training_config.py::test_train_validates_the_reference — slow integration (logic now covered by the direct-call test_train_validates_the_reference and test_bad_references_fail_with_a_reason) removed WebApi/tests/test_webapp.py — slow integration (logic now covered by existing WebApp unit tests for figure, row and export builders; loaded-page browser coverage is deferred to P5.5) removed WebApi/tests/test_webapp.py::test_every_page_loads_from_the_api — slow integration (logic now covered by existing WebApp unit tests for figure, row and export builders; loaded-page browser coverage is deferred to P5.5)
18 lines
502 B
Python
18 lines
502 B
Python
import pytest
|
|
|
|
from persistance import destination
|
|
|
|
|
|
@pytest.fixture
|
|
def fresh_platform(tmp_path, monkeypatch):
|
|
monkeypatch.setattr(destination, "DATA_DIR", tmp_path)
|
|
monkeypatch.setenv("PLATFORM_DATABASE_URL", f"sqlite:///{tmp_path / 'platform.db'}")
|
|
monkeypatch.setenv("DLT_DATA_DIR", str(tmp_path / "dlt"))
|
|
destination.engine.cache_clear()
|
|
engine = destination.engine()
|
|
try:
|
|
yield engine
|
|
finally:
|
|
engine.dispose()
|
|
destination.engine.cache_clear()
|