MCPcopy Create free account
hub / github.com/Screenly/Anthias / asset_dir

Function asset_dir

tests/test_processing.py:85–102  ·  view source on GitHub ↗

Point ``settings['assetdir']`` at a fresh per-test tempdir. Each test that writes a fixture file lands it under here, and asserts on what survives. ``Asset.objects.all().delete()`` clears DB rows between tests because ``django_db`` rollback covers persisted writes but the celery tas

(tmp_path: Any)

Source from the content-addressed store, hash-verified

83
84@pytest.fixture
85def asset_dir(tmp_path: Any) -> Iterator[str]:
86 """Point ``settings['assetdir']`` at a fresh per-test tempdir.
87
88 Each test that writes a fixture file lands it under here, and
89 asserts on what survives. ``Asset.objects.all().delete()`` clears
90 DB rows between tests because ``django_db`` rollback covers
91 persisted writes but the celery tasks above call
92 ``Asset.objects.update`` directly, which doesn't always observe
93 the wrap.
94 """
95 Asset.objects.all().delete()
96 original = anthias_settings['assetdir']
97 anthias_settings['assetdir'] = str(tmp_path)
98 try:
99 yield str(tmp_path)
100 finally:
101 anthias_settings['assetdir'] = original
102 Asset.objects.all().delete()
103
104
105def _make_processing_asset(

Callers

nothing calls this directly

Calls 1

deleteMethod · 0.80

Tested by

no test coverage detected