This commit is contained in:
@@ -142,6 +142,26 @@ def test_preload_old_file(tmp_path, caplog):
|
|||||||
# Vérifie que le PV n’a pas été créé (pas dans le cache)
|
# Vérifie que le PV n’a pas été créé (pas dans le cache)
|
||||||
assert not is_pv_in_cache(pvname)
|
assert not is_pv_in_cache(pvname)
|
||||||
|
|
||||||
|
def test_preload_fichier_corrompu(tmp_path, caplog):
|
||||||
|
configure_logzero_for_pytest(caplog)
|
||||||
|
|
||||||
|
f = tmp_path / "corrupt.pkl"
|
||||||
|
|
||||||
|
# Écrit un fichier non valide (pas du pickle)
|
||||||
|
with open(f, "w") as fcorrupt:
|
||||||
|
fcorrupt.write("not a pickle at all")
|
||||||
|
|
||||||
|
# Patch le chemin du fichier dans preload
|
||||||
|
with pytest.MonkeyPatch().context() as mp:
|
||||||
|
mp.setattr("slic.utils.pvpreload.fn", f)
|
||||||
|
|
||||||
|
with caplog.at_level("WARNING"):
|
||||||
|
preload()
|
||||||
|
|
||||||
|
logs = "\n".join(caplog.messages)
|
||||||
|
assert "PV preload file not loaded due to: UnpicklingError:" in logs
|
||||||
|
|
||||||
|
|
||||||
# offload()
|
# offload()
|
||||||
def test_offload(tmp_path, caplog):
|
def test_offload(tmp_path, caplog):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user