mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
test(memory): restore the parent package attribute after the writers reimport
The deprecation test re-imports headroom.memory.writers. Also remove and restore headroom.memory.writers on the parent package, so later tests see one package object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c1d2b6b9df
commit
58e5702d66
@@ -26,7 +26,12 @@ from headroom.memory.writers.generic_writer import GenericMemoryWriter
|
||||
|
||||
|
||||
def test_importing_the_writers_package_warns_deprecated(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.delitem(sys.modules, "headroom.memory.writers")
|
||||
# Restore both the sys.modules entry and the parent attribute afterwards, so
|
||||
# later tests see the original package object whatever the import form.
|
||||
import headroom.memory
|
||||
|
||||
monkeypatch.delitem(sys.modules, "headroom.memory.writers", raising=False)
|
||||
monkeypatch.delattr(headroom.memory, "writers", raising=False)
|
||||
with pytest.warns(DeprecationWarning, match="headroom.memory.writers is deprecated"):
|
||||
importlib.import_module("headroom.memory.writers")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user