Cluster ERP'nin Python testleri tests/ içindedir ve pytest ile çalışır. Bu sayfa yapılandırmayı, CI'ın kullandığı komutu, alana göre gruplanmış dosyaları ve canlı bir sunucu veya veritabanı isteyen testlerin kurallarını listeler. Tarayıcı testleri ayrı bir süittir; bkz. e2e bataryası.
Kapsam ve kaynak¶
- Tanımlandığı yer:
tests/test_*.pyvepyproject.tomliçindeki[tool.pytest.ini_options]. - Çalıştıran: CI işi
test(.github/workflows/ci.yml:124). - Sayı: 106 test dosyası,
ls tests/test_*.pyile sayıldı. Klasörde ve depo kökündeconftest.pyyoktur (lsile arandı).
Yapılandırma¶
| Ad | Değer | Anlam | Kaynak |
|---|---|---|---|
asyncio_mode |
auto |
async def testleri işaretleyici olmadan çalışır |
pyproject.toml:152 |
testpaths |
tests |
pytest yalnız tests/ klasörünü toplar |
pyproject.toml:153 |
| pytest | >=8.0.0 |
dev ekindeki en düşük sürüm |
pyproject.toml:81 |
| pytest-asyncio | >=0.24.0 |
dev ekindeki en düşük sürüm |
pyproject.toml:82 |
Testleri çalıştırma¶
CI süiti, tüm göçleri boş bir PostgreSQL 16 veritabanına uyguladıktan sonra çalıştırır (.github/workflows/ci.yml:113, .github/workflows/ci.yml:124):
python -m pytest -q --no-header -p no:cacheprovider
Aynı iş CLUSTER_SKIP_LIVE_TESTS değişkenini 1 yapar (.github/workflows/ci.yml:99). İş akışı yorumu nedenini belirtir: canlı bekçiler açılmış bir sunucu ister ve CI bunları muafiyet görünür olsun diye muaf tutar (.github/workflows/ci.yml:17-20).
Canlı testler¶
Canlı bir test çalışan bir sunucu veya erişilebilir bir test veritabanı ister. Sekiz dosya CLUSTER_SKIP_LIVE_TESTS değişkenini okur (grep -l ile sayıldı). İki kalıp kullanırlar.
| Kalıp | Davranış | Dosyalar | Kaynak |
|---|---|---|---|
| Muafken tüm modülü atla | Modül düzeyindeki bir skipif, değişken 1 olduğunda her testi atlar |
test_cal03_owner_calendars_live.py, test_calendar_owner_inherits_group_live.py, test_change_history_tables_live.py, test_deactivation_sweep_live.py, test_demo_data_live.py, test_login_budget_live.py |
tests/test_demo_data_live.py:24-27, tests/test_cal03_owner_calendars_live.py:22-24 |
| Muaf değilse başarısız ol | Sunucu yoksa test başarısız olur; başarısızlığı yalnız değişken atlamaya çevirir | test_readiness_contract.py, test_search_contract.py |
tests/test_readiness_contract.py:37-44, tests/test_search_contract.py:162-171 |
İkinci kalıp, "a silently skipped guard is indistinguishable from a passing one" olduğu için vardır (tests/test_readiness_contract.py:12-14). Canlı HTTP testleri sunucu adresini, tarayıcı bataryasının da kullandığı CLUSTER_E2E_BASE değişkeninden okur (tests/test_readiness_contract.py:27).
Diğer testler bu değişken olmadan ortamlarına bağlıdır:
| Koşul | Davranış | Kaynak |
|---|---|---|
| Erişilebilir veritabanı yok | Kısmi indeks ve yabancı anahtar indeksi denetimleri atlanır | tests/test_live_row_uniqueness.py:88-89, tests/test_fk_indexes.py:97-98 |
Makinede bash yok |
Düğüm betiği testleri atlanır | tests/test_bootstrap_node_script.py:35, tests/test_pg_tune_script.py:32 |
bash veya git yok |
Kurulum betiği testi atlanır | tests/test_install_role_gate.py:41-44 |
Alana göre test dosyaları¶
Dosyalar adlarına ve modül belge dizelerine göre gruplandı. Bir dosya yalnız bir gruptadır.
| Alan | Sayı | Dosyalar |
|---|---|---|
| Mimari, statik kalite ve şema bekçileri | 9 | test_architecture_boundaries.py, test_e2e_db_isolation.py, test_fk_indexes.py, test_fresh_install_contract.py, test_live_row_uniqueness.py, test_meta_representations.py, test_metadata_driven_rules.py, test_static_quality.py, test_webapp_asset_links.py |
| Analitik | 18 | test_analytics_classification.py, test_analytics_contributions.py, test_analytics_cross.py, test_analytics_forecasting.py, test_analytics_gates.py, test_analytics_inference.py, test_analytics_inference2.py, test_analytics_logit.py, test_analytics_pca_kmeans.py, test_analytics_plots.py, test_analytics_profiling.py, test_analytics_recipe.py, test_analytics_rmanova.py, test_analytics_saved_models.py, test_analytics_shapiro.py, test_analytics_statistics.py, test_analytics_stratification.py, test_analytics_summaries.py |
| Kimlik, erişim, kiracılık ve gizlilik | 30 | test_abac_enforcement.py, test_abac_evaluator.py, test_abac_policy_condition.py, test_admin_bootstrap.py, test_at_rest_and_second_factor.py, test_auth_cache_stamp.py, test_authz_conformance.py, test_change_history_redaction.py, test_content_disposition.py, test_data_map_package1.py, test_data_map_package2.py, test_data_map_package3.py, test_data_map_package4.py, test_entitlement_stamp.py, test_erasure_ledger.py, test_log_sanitizer.py, test_login_budget_live.py, test_login_identifier.py, test_privacy_requests.py, test_residency_check.py, test_row_scope.py, test_secure_defaults.py, test_sensitive_fields_policy.py, test_settings_regions.py, test_settings_secret.py, test_signup_closed.py, test_signup_notice.py, test_signup_tokens.py, test_signup_validation.py, test_tenancy.py |
| İşletim, dağıtım ve açılış | 18 | test_alembic_env_logging.py, test_backup_pipe.py, test_backup_retention.py, test_boot_migration_lock.py, test_bootstrap_node_script.py, test_change_history_tables_live.py, test_control_retention.py, test_database_plan_cache.py, test_deactivation_sweep_live.py, test_demo_data_live.py, test_install_restart_policy.py, test_install_role_gate.py, test_pg_tune_script.py, test_readiness_contract.py, test_request_cost.py, test_security_txt.py, test_server_keep_alive.py, test_staging_fixtures_guard.py |
| İş kuralları ve modül davranışı | 28 | test_board_calendar_chain.py, test_bom_bugfix_batch_2026_10_08.py, test_cal03_owner_calendars_live.py, test_calendar_owner_inherits_group_live.py, test_intranet_event_lifecycle.py, test_intranet_request_type_seeds.py, test_leave_day_math.py, test_mail_transport.py, test_nesting_units.py, test_order_shipment_chain.py, test_party_form_contract.py, test_procurement_descriptions.py, test_record_formatter_csv.py, test_record_links.py, test_refresh_routing_body.py, test_sales_delivery_day_party.py, test_scheduling_calendar.py, test_scheduling_calendar_chain.py, test_scheduling_capacity_units.py, test_search_contract.py, test_store_catalog_assets.py, test_subscription_math.py, test_system_mail.py, test_tenant_field_catalog.py, test_tenant_fields.py, test_work_center_capacity_cap.py, test_working_time_dst.py, test_working_time_overrides.py |
| Masaüstü istemci | 3 | test_desktop_app_scope.py, test_desktop_datetime_field.py, test_desktop_table_text_insets.py |
Mimari bekçiler mimari sınırlar sayfasında açıklanır. Statik kalite testi Ruff ve mypy çalıştırır; bkz. lint ve tip denetimi. tests/test_e2e_db_isolation.py tarayıcı süitlerini metin olarak denetler; bkz. e2e bataryası.
Kısıtlar ve doğrulama¶
- Alt süreç başlatan veya bir veritabanına ulaşan testler kendi veritabanlarını adlandırır; batarya yalıtım bekçisi yalnız tarayıcı süitleri için geçerlidir (
tests/test_e2e_db_isolation.py:1-19). - Koddan belirlenemedi: bir kapsam ölçümü.
pyproject.tomliçinde kapsam aracı bildirilmez ve.github/workflows/ci.ymliçinde çalışmaz.
Tanıtılan terimler¶
| Terim | Kod tanımlayıcısı | Tanım | Türkçe terim | Kaynak |
|---|---|---|---|---|
| live test | CLUSTER_SKIP_LIVE_TESTS |
Çalışan bir sunucu veya erişilebilir bir test veritabanı isteyen ve değişkenin muaf tutabildiği pytest testi. | Canlı test | tests/test_readiness_contract.py:12-14 |
İlgili sayfalar¶
92f8051 numaralı commit ile 2026-11-13 tarihinde doğrulandı.