|
9 | 9 | from helper.config import cfg |
10 | 10 | from tasks.init_db_task import _init_db, get_connection |
11 | 11 | from tasks.update_software_items import ( |
12 | | - SOFTWARE_PROFILE_QID, |
13 | | - MARDI_PROFILE_TYPE_PID, |
14 | 12 | build_query, |
15 | 13 | run_query, |
16 | 14 | update_software_item_index_from_mardi, |
@@ -63,8 +61,10 @@ def fake_run_query(endpoint: str, query: str, logger, max_retries: int, timeout: |
63 | 61 |
|
64 | 62 | monkeypatch.setattr("tasks.update_software_items.cfg", fake_cfg) |
65 | 63 | monkeypatch.setattr("tasks.update_software_items.run_query", fake_run_query) |
66 | | - monkeypatch.setattr("tasks.update_software_items.SOFTWARE_PROFILE_QID", "QSOFT") |
67 | | - monkeypatch.setattr("tasks.update_software_items.MARDI_PROFILE_TYPE_PID", "PPID") |
| 64 | + # Ensure globals are present for backward compatibility in the module |
| 65 | + mod = __import__("tasks.update_software_items") |
| 66 | + setattr(mod, "SOFTWARE_PROFILE_QID", "QSOFT") |
| 67 | + setattr(mod, "MARDI_PROFILE_TYPE_PID", "PPID") |
68 | 68 | monkeypatch.setattr("tasks.update_software_items.time.sleep", lambda _: None) |
69 | 69 | monkeypatch.setattr("tasks.update_software_items.get_run_logger", lambda: logging.getLogger("test_logger")) |
70 | 70 |
|
@@ -110,7 +110,5 @@ def test_run_query_against_real_endpoint(monkeypatch): |
110 | 110 |
|
111 | 111 | assert len(results) <= limit |
112 | 112 | assert all(qid.startswith("Q") for qid in results) |
113 | | - if not SOFTWARE_PROFILE_QID or not MARDI_PROFILE_TYPE_PID: |
114 | | - pytest.skip("Profile constants not configured; skipping integration assertion") |
115 | | - assert SOFTWARE_PROFILE_QID.startswith("Q") |
116 | | - assert MARDI_PROFILE_TYPE_PID.startswith("P") |
| 113 | + assert wb_cfg.get("mardi_software_profile_qid", "").startswith("Q") |
| 114 | + assert wb_cfg.get("mardi_profile_type_pid", "").startswith("P") |
0 commit comments