:memory: is a SQLite sentinel. JsonDB has no such concept, so when it is handed that string as a db_path it does the only thing it can: creates a literal directory named :memory: and writes to it.
That directory lands in the repo root, untracked, and persists after the run:
:memory:/node/n.Root.root.json
Where
tests/api/decorators/test_deferred_registry.py builds its server config with:
database=DatabaseConfig(db_type="json", db_path=":memory:")
...at lines 119, 162, 177, 197, 212, 239, 272, 299.
Why it matters
Two separate problems:
- Test isolation. The suite writes into the working directory and leaves the artifact behind. Anyone running
pytest locally accumulates a :memory: directory in their checkout, and git status grows a permanent untracked entry that is easy to git add -A by accident.
- The tests are not testing what they intend. They are asking for an ephemeral in-memory database and silently getting a persistent on-disk one. State survives within a run, and across runs, in a way the author plainly did not intend.
Repro
git status --short # clean
pytest tests/api/decorators/test_deferred_registry.py -q
git status --short # ?? :memory:/
Suggested fix
Use tmp_path for the json path, which is what the tests actually want:
database=DatabaseConfig(db_type="json", db_path=str(tmp_path / "jvdb"))
Worth considering separately: JsonDB could reject ":memory:" outright rather than creating a strangely-named directory. Silently interpreting a sentinel from another backend as a relative path is the part that made this invisible.
Found while running the full suite during #37 / #38.
:memory:is a SQLite sentinel.JsonDBhas no such concept, so when it is handed that string as adb_pathit does the only thing it can: creates a literal directory named:memory:and writes to it.That directory lands in the repo root, untracked, and persists after the run:
Where
tests/api/decorators/test_deferred_registry.pybuilds its server config with:...at lines 119, 162, 177, 197, 212, 239, 272, 299.
Why it matters
Two separate problems:
pytestlocally accumulates a:memory:directory in their checkout, andgit statusgrows a permanent untracked entry that is easy togit add -Aby accident.Repro
Suggested fix
Use
tmp_pathfor the json path, which is what the tests actually want:Worth considering separately:
JsonDBcould reject":memory:"outright rather than creating a strangely-named directory. Silently interpreting a sentinel from another backend as a relative path is the part that made this invisible.Found while running the full suite during #37 / #38.